2

I have the following PHP script:

#!/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:

find: write error: Broken pipe

This error never occurs if I run the equivalent command directly from the 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);

Does anyone have any idea what might be going on?

2 Answers 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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I'm using Ubuntu Hardy so the linked issue doesn't directly apply.
0

Does PHP throw any errors? Maybe max_execution_time is too low? Mu guess PHP app exites prematurely.

1 Comment

No, PHP doesn't throw any errors and I can put code after the shell_exec call and it gets executed so I don't think it's timing out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.