I have the following PHP script:
我有以下PHP脚本:
#!/usr/bin/php
<?php
echo shell_exec(
"/usr/bin/git clone --bare ".
"/home/dave/create_project/template_project ".
"/home/dave/create_project/my_test_project.git"
);
About 7 in 10 times that I run it, git gives the following error:
我运行它的时候大约有7次,git给出了以下错误:
find: write error: Broken pipe
This error never occurs if I run the equivalent command directly from the shell.
如果我直接从shell运行等效命令,则不会发生此错误。
I have already tried:
我已经尝试过了:
- using other PHP execution functions:
exec
,system
,popen
; - passing the whole command as an argument to bash, i.e.,
exec('bash -c '.$cmd);
使用其他PHP执行函数:exec,system,popen;
将整个命令作为参数传递给bash,即exec('bash -c'。$ cmd);
Does anyone have any idea what might be going on?
有谁知道可能会发生什么?
2 个解决方案
#1
It may depend on your exact platform, but findutils has been known to throw that kind of error message before.
On Fedora, that rpm package version 4.2.33-2.fc9 fixed the issue.
它可能取决于您的确切平台,但已知findutils会抛出此类错误消息。在Fedora上,rpm包版本4.2.33-2.fc9解决了这个问题。
#2
Does PHP throw any errors? Maybe max_execution_time is too low? Mu guess PHP app exites prematurely.
PHP会抛出任何错误吗?也许max_execution_time太低了?我猜PHP应用程序过早出现。
#1
It may depend on your exact platform, but findutils has been known to throw that kind of error message before.
On Fedora, that rpm package version 4.2.33-2.fc9 fixed the issue.
它可能取决于您的确切平台,但已知findutils会抛出此类错误消息。在Fedora上,rpm包版本4.2.33-2.fc9解决了这个问题。
#2
Does PHP throw any errors? Maybe max_execution_time is too low? Mu guess PHP app exites prematurely.
PHP会抛出任何错误吗?也许max_execution_time太低了?我猜PHP应用程序过早出现。