You have a problem with the user executing the command.
According to your various comments, system commands are executed as a user named apache (homedir /var/www ). You can verify this by running the whoami from your PHP script:
<?php echo `whoami`;
This user, called apache , is usually the user of your web server that runs PHP, which then runs shell commands.
Obviously, you want to run the command as some other user, but you still have not shared information about which one.
Run the shell command under the desired user, and the problem should disappear.
In a linux system, a command to run other commands under a different user is called sudo , another su :
Alternatively, you can use suexec to execute PHP under a different user than the web server user.
In any case, you need to make sure that you have a user who can execute the git command. I donโt know how you tested this yourself, the best way I know is ssh in the server field, do git pull manually and collect the necessary data such as username, homedirectory etc.
hakre
source share