1

I have a shell script that called ant -buildfile /some/where/build.xml

That works fine. When I try to exec('shellScript'); or exec('ant -buildfile /some/where/build.xml'); it will fail. I have tried passthru, system, pcntl_exec, popen, and shell_exec with both the shell script and the command.

The build script uses SVN, and checks out some files. That's where it fails. In the ant script output, I get: checkoutTrunk: [svn] started ... [svn] failed !

When I run the command or the shell script from SSH, everything works fine. Why would being called from a PHP script stop the checkout from working?

1 Answer 1

1

After getting nowhere, I changed the command it was trying to execute to 'id'. I found out that PHP was running as a different user than I thought. When I SSH as that user, I get an error when I run the command due to not having access to write to a directory. Once I changed permissions on those directories, I could then run the command as the PHP user from SSH. After I could do that, it also worked from the PHP script.

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

Comments

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.