I have everything setup with git and my server (godaddy shared hosting) regarding SSH keys and can update the server successfully via SSH with git pull git@github.com:username/reponame.git
I'm attempting to use simple-php-git-deploy to automatically update a test server when I commit changes to my git repo
When the below php script excerpt runs shell_exec('which git')
the function returns an empty string.
Since I can run git commands in SSH, I feel like this must be a permissions issue.
I tried running chmod 755 foldertoupdate
with no change.
What do I need to do to allow php (or the current apache user) to call git commands?
// Check if the required programs are available
$requiredBinaries = array('git', 'rsync');
//.....
foreach ($requiredBinaries as $command) {
$path = trim(shell_exec('which '.$command));
if ($path == '') {
die(sprintf('<div class="error"><b>%s</b> not available. It needs to be installed on the server for this script to work.</div><br> Output was: %s', $command,$path )); // this check fails on the first element, "git" claiming git is not installed
} else {
$version = explode("\n", shell_exec($command.' --version'));
printf('<b>%s</b> : %s'."\n"
, $path
, $version[0]
);
}
}
More Info:
- The folder I'm updating is at
~/html/TeamBoard
- The file I'm calling the code from is at
~/html/TeamBoard/deploy.php