- I did clone as apache user
- Created php file with
exec("git pull origin master 2>&1", $out);
Terminal as root or as apache works fine: php auto_deploy.php
But http http://.../auto_deploy.php return error
error: cannot open .git/FETCH_HEAD: Permission denied
Folder owner and group are same "apache".
Chmod 777 does not help.
The main difference is, that when php file launched from HTTP it does not work, it feels like it knows that it is http and blocking it, because in terminal Apache user works perfect with git even launching php file.