【发布时间】:2012-05-28 05:32:28
【问题描述】:
我正在尝试在运行 XAmpp 的 Windows 上使用 PHP 的 exec 从 git 运行拉取请求。当使用exec 或system 运行下面的脚本并尝试访问文件时,页面永远不会停止加载。我检查了目录的文件权限,它们都是 0777。运行git status 运行良好。不知道是什么问题。
<?php
ignore_user_abort(true);
set_time_limit(15);
exec('git pull origin master', $o);
echo implode("\n", $o);
?>
更新帐户没有密码:
C:\xampp\htdocs>git pull origin master
From github.com:************
* branch master -> FETCH_HEAD
Already up-to-date.
C:\xampp\htdocs>
从终端运行我得到:
C:\xampp\htdocs>php -f update.php
PHP Warning: PHP Startup: ming: Unable to initialize module
Module compiled with build ID=API20090626,TS,VC6
PHP compiled with build ID=API20090626,TS,VC9
These options need to match
in Unknown on line 0
Warning: PHP Startup: ming: Unable to initialize module
Module compiled with build ID=API20090626,TS,VC6
PHP compiled with build ID=API20090626,TS,VC9
These options need to match
in Unknown on line 0
From github.com:*********
* branch master -> FETCH_HEAD
Already up-to-date.
C:\xampp\htdocs>
【问题讨论】:
-
git 是否在等待其他用户输入,例如密码?
set_time_limit()在这里没有帮助,因为它只适用于 PHP 执行时间。 -
没有密码也更新了帖子。
-
您正在从终端运行 PHP 脚本,是吗?或者,您是从网络上运行它吗?如果来自网络,我敢打赌你的 git 配置取决于你的环境变量,如果从不同的用户(网络服务器的用户)运行,环境变量会有所不同。
-
从您的终端运行它。看看它是否在那里工作。
-
更新了帖子。我不确定这 2 个警告是什么,但它确实会在几秒钟内运行并完成。
标签: php windows git xampp exec