Can someone let me know why I'm unable to clone local repos开发者_如何学编程 using the following code:
$output = shell_exec('hg clone http://localhost/hg/TestProject/');
echo "<pre>$output</pre>";
The output is "127". What's wrong? It's working perfectly through terminal.
Thanks.
sh -c X
returns 127 when X does not exist. This probably means hg
is not in the path when you execute the script. You could run which hg
to find out what the full path is and supply that instead (mine is /usr/bin/hg
), or you could set the PATH environment variable so that hg
can be found.
Seems that PHP can't find the hg executable. Try to specify the full path to hg
精彩评论