OS - Ubuntu 14.04
Well I am working on deployment using GIT webhooks for it.
I havea added the deployment keys to git repo and now I want to trigger the git pull origin master command
when a push happens from my local repo.
This is the test.php file I call via browser.
<?php
//echo "THis is a test file on a test repo for testing the deploy functionality using github webhooks!!!!";
echo exec('whoami');
echo exec('sh -x /var/www/iq/deploy-test/git.sh');
?>
the shell file
#!/bin/bash
cd /var/www/proj-dir/deploy-test
git pull origin master
When I run this on terminal using
php test.php
I get the correct result as expected
ubuntu From github.com:repo/test
* branch master -> FETCH_HEAD
Already up-to-date.
ubuntu for whoami
and the git pull output.
Now heres the issue when I call the same http://example.com/test.php
on browser it shows the user or whoami
output as www-data
,which is apache user,but I tried updating the permissions of the php file to execute and changing the user to www-data
but did not work.
What updates do I need to make so the file works via browser request?
If I need to update the sudoers file what should be the updates?
whoami
should not work right? @muruPlease make sure you have the correct access rights and the repository exists. + cd /var/www/proj/deploy-test + git pull origin master Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
But when I run it via terminal(php test.php
) it works fine.known_hosts
, and b) won't have access to your private key for authentication.