I’m writing some functions in php using exec() to interrogate a svn.
The commands exec("svn list ".$myurl) works.
Now, I try to get a path on a svn repository with the checkout command.
When I put the command “svn checkout http://core.wordress.org/tags/2.9.2/ last-version” directly in the console, it works.
But when I do this from a php script using exec(), like this :
exec("svn checkout ".$myurl, $dir)
it doesn’t work.
Have you an idea ??
This can have a variety of reasons.
The user PHP runs under is not allowed to write into the directory you want to check out into
The SVN repository requires login credentials that are not cached for the user PHP runs under
The SVN checkout process starts, but requires some additional input like the dreaded “Do you want to accept this certificate” with unsigned certificates.
Try adding
2>&1to the command to redirect stderr to stdout, and take a look at$dir. Also make use of the$return_varparameter to exec().And as Jacob pointed out, always use
escapeshellargs()for your command arguments.