我正在尝试在运行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:xampphtdocs>git pull origin master
From github.com:************
* branch master -> FETCH_HEAD
Already up-to-date.
C:xampphtdocs>
从终端运行 i 得到:
C:xampphtdocs>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:xampphtdocs>
不要使用
exec
,它会等到过程完成,而是使用 passthru
并确保禁用了输出缓冲。这样,您将立即看到问题所在。