【发布时间】:2015-07-28 17:05:02
【问题描述】:
我编写了简单的 php 脚本来帮助我在提交发送到 bitbucket 时更新站点内容。我有以下问题。
<?php
$repo_dir = '/var/www/vhosts/my_full_path';
$output = shell_exec('cd '.$repo_dir.' && hg --config auth.rc.prefix=https://bitbucket.org/XXXXX --config auth.rc.username=my_username --config auth.rc.password=my_pass pull -u https://bitbucket.org/XXXXXXX &');
echo $output;
?>
当我将它输入到网络浏览器时,它不起作用。脚本的输出是:
pulling from https://bitbucket.org/XXXXXXXXXXXXXX
但是当我尝试在服务器上的控制台下执行它时,它就像一个魅力:
php myscript.php
生成以下输出:
pulling from https://bitbucket.org/XXXX
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
看到输出是完整和正确的!在 concole 中,我在 Web 浏览器数据 www 中使用 root 用户?这种情况有什么不同吗?
【问题讨论】:
-
也许这些文件不能被 data-www 写入和执行,因为它们归 root 所有?非常请:不要使用 root 测试东西......
标签: php mercurial shell-exec