【发布时间】:2016-01-12 00:38:24
【问题描述】:
我有一个来自 Github 的 git pull web hook,在两个遥控器上,GoDaddy [production] 和 Bluehost [staging]。这个问题与这些公司本身无关,而可能是设置差异的原因。我有这个脚本,我在 github.com 上将它设置为提交后挂钩:
<?php
$output = shell_exec('git pull origin master');
echo "<pre>$output</pre>";
?>
当我在 Github 存储库上提交时,钩子会触发并在 Bluehost 上正常工作。它对 Godaddy 没有任何作用。
Bluehost 浏览器响应:
"already up to date". Pull command works, and the Bluehost repo is updated.
Godaddy 浏览器响应:
<pre></pre> Pull command has not worked. Repo not updated.
当我通过浏览器运行此脚本时:
<?php
$output = shell_exec('ls');
echo "<pre>$output</pre>";
?>
我在两台服务器上都得到了正确的“ls”目录输出。
当我 SSH 进入目录时,我可以手动发出命令“git pull origin master”,它在两台服务器上都可以工作。那么这是否只是意味着 Godaddy 允许 PHP 发出一些命令,但不允许其他命令?我能以某种方式解决这个问题吗?没有人会自动部署到 Godaddy,这不可能是真的!
【问题讨论】:
-
shell_exec是否执行了某些操作?喜欢echo或ls? -
在 godaddy 或 VPS 上共享主机?
标签: git shared-hosting bluehost