Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a php script to git pull from my github repository set up in my webservice hook urls like so:

  echo shell_exec('~/git/usr/bin/git pull 2>&1');

When I open this script on the browser, I get this error:

git-remote-https: error while loading shared libraries: libcurl.so.3: cannot open shared object file: No such file or directory

I am on a godaddy server running CentOS release 5.9 and uname -mrs yields:

Linux 2.6.18-348.3.1.el5PAE i686

When I tried doing :

yum install curl

I get an error that the command yum cannot be found.

I seriously have no idea what's going on here because when I ssh into my server and do git pull from the terminal or run the script like php myscript.php, it works fine and all the changes are fetched. How are the dependencies changed when I run it in the browser?

Any help is deeply appreciated.

share|improve this question

migrated from askubuntu.com Jun 11 '13 at 11:23

This question came from our site for Ubuntu users and developers.

sudo apt-get install libcurl3 – nickanor Jun 9 '13 at 8:42
I am on centOS as I mentioned and commands like sudo and apt-get can't be used. Also. because I am on a godaddy shared hosting I don't exactly have the permissions for everything. Thanks again – Vivek Pradhan Jun 11 '13 at 9:57

First of all, this is not an Ubuntu-related question, see What topics can I ask about here? – you are asking about PHP script running on CentOS on a shared hosting. Either Unix & Linux, Stack Overflow, Server Fault, or other Stack Exchange sites are better suited for this question.

Anyway, it seems you are somehow using different URLs to pull from GitHub; git-remote-https needs curl for HTTPS access. Use either SSH or Git (Read-Only) protocol, i.e. git@github.com:user/repository.git or git://github.com/user/repository.git; try changing your remote URL or cloning the repository again. Also, make sure that Git is executed in the right directory, for example add cd /my/repo; to the shell_exec command. Also, it's for the best to specify remote branch for automated pulls, i.e. git pull origin master.

It is possible that GoDaddy limits access of PHP scripts to certain libraries – which also affects shell scripts executed within PHP's context. If everything else fails, you may consider polling the remote repository, i.e. execute git pull periodically with Cron.

share|improve this answer
Thanks for guiding me @jnv. I will be more careful the next time I ask questions on stackexchange. curl is already installed on the server. When I try to do git://github.com/user/repository.git, I get an error saying that it could not connect a socket (Connection refused). I have the path of the git binary set up correctly. I think it has something to do with the dependency, may be it's not able to locate curl. All of the scripts are running when I execute them in the terminal after sshing into my server. – Vivek Pradhan Jun 11 '13 at 11:54
As far as establishing an ssh connection to the repository hosted on github is concerned. I don't have the permissions to do that. So once I ssh into my server, I cannot successfuly run ssh git@github.com. I get an error saying ssh: Permission denied. So I can only use http or http(s) solutions and I can clone repositories as I mentioed. The php script is not getting executed from the browser. That's the problem and the error I get is already posted in the question. Hope this helps. – Vivek Pradhan Jun 11 '13 at 11:58
I see; it's quite a common practice that PHP scripts are executed with different user/group, but it's also possible that shell_exec runs under the same account but doesn't get all environment variables to locate shared libraries for your local installation of git. You could try spawning a full shell from PHP, i.e. executing /bin/bash -lc 'YOUR COMMAND HERE'; also: locate libcurl.so.3 and make sure your Git can access it – check permissions and try making a symlink in ~/git/usr/lib/ or wherever shared libraries for your local git are placed. Also, try Cron as I've noted previously. – jnv Jun 11 '13 at 12:20
I tried spawning a full shell from PHP like you suggested but I still get the same error. Also there is no folder called lib where I have git installed. Do you think that's causing the problem? – Vivek Pradhan Jun 14 '13 at 7:20
I was just assuming there may be such directory but just because it's missing isn't probably the source of problem – I don't know how exactly did you install Git. Locate the missing library and check its permissions and/or whether PHP process has an access to it. And try polling through Cron. Otherwise I recommend contacting GoDaddy support, hopefuly they know limitations of their system and will be able to help you. – jnv Jun 15 '13 at 18:08
yum install curl

I get an error that the command yum cannot be found

Are you root? Is is possible that your $PATH doesn't contain /sbin:/usr/sbin? Try /sbin/yum and /usr/sbin/yum to make sure that it's not a $PATH issue.

I'm not a CentOS expert, but if you are in fact working as root, and yum is really not installed and working, then your system may be seriously broken. As far as I know, yum is the default package manager of CentOS and should absolutely both exist and work.


That is a very strange path. It looks like you manually extracted the git package into your home directory?

error while loading shared libraries: libcurl.so.3

Well, if you extracted the package manually, it's probably now missing the curl library that the git package depends on. You could try extracting this library too, but just putting it into your home directory won't magically make it work... you will probably need to fiddle with $LD_LIBRARY_PATH to make that work, which in my experience isn't very easy.

If you can get yum working and then use it to install the `git package properly, it would solve this problem for you.

share|improve this answer
Thanks a lot for your reply @Martin. Considering the fact that I haven't been able to resolve the issue yet, I will definitely follow your suggestions and see what I come up with. – Vivek Pradhan Sep 20 '13 at 19:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.