Auto pull php script
Uncomment the exec to show the apache user (e.g. daemon, www-data or www) and if it has permission to execute shell commands.
Next step is to make sure you’re apache user has read and write access to the entire repository.
sudo chown -R ssh_user:www-data repository/ sudo chmod -R g+wrx repository/
The apache user needs to have a key to talk to the server.
sudo -u www-data ssh-keygen -t rsa
ssh-keygen will tell us where it’s creating the keys.
Make sure your apache user is the owner of the .ssh directory that the keys are being created in.
Add key to ssh-agent
eval "$(ssh-agent -s)"
sh-add -k /var/www/.ssh/id_rsa
Copy public key to your project host
Allow the project host to access the server.
(e.g. repository settings > deployment keys)
Test apache user in the shell.
This step is super important.
sudo -u www-data git pull
Then test your apache user in the browser.
Go to your project host and setup your webhook to point to your php auto pull script.