dsa2c2255888 2012-05-21 17:40
浏览 68
已采纳

在PHP中运行来自EXEC的'git pull'

I'm trying to run a pull request from git using PHP's exec on windows running XAmpp. When running the script below with exec or system and try to access the file the page just never stops loading. I've check the file permissions of the directory and they're all 0777. & running git status runs fine. Not sure what the problem is.

<?php
ignore_user_abort(true);
set_time_limit(15);
exec('git pull origin master', $o);
echo implode("
", $o);
?>

Update there isn't a password on the account:

C:\xampp\htdocs>git pull origin master
From github.com:************
 * branch            master     -> FETCH_HEAD
Already up-to-date.

C:\xampp\htdocs>

Running from terminal i get:

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>
  • 写回答

1条回答 默认 最新

  • douji9184 2012-05-25 20:24
    关注

    Instead of using exec, which waits until the process is finished, use passthru and make sure you disabled output buffering. This way you'll immediately see what the problem is.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题