user602464
user602464

Reputation: 243

SVNANT Script Fails When Called By PHP Script

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?

Upvotes: 1

Views: 138

Answers (1)

user602464
user602464

Reputation: 243

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.

Upvotes: 1

Related Questions