views:

1470

answers:

3

I'm using WAMP as a server, and I have a need to execute svn, which can be found in my Windows directory: C:/Program Files/Subversion/bin/

The problem, is that when I launch the php program from the server, it won't produce output. It works from the command line, which makes me think this is a permissions problem with WAMP. However after giving it unlimited power, it still won't execute svn commands unless I call it from the command line.

I've tried calling it with the full path to svn, and it's regular path. Other commands like "dir" work fine.

To clarify my question: How can I execute svn from php through WAMP?

+1  A: 

PHP has a whole bunch of functions which deal explicitly with svn repositories and doesn't require you to use any system()-type functions.

Since you said you cannot use the various svn functions, try the following:

<?php
    $cmd = 'set PATH';
    echo '<pre>' , shell_exec( $cmd ) , '</pre>';
?>

See what that returns (look for the PATH environment variable). See what PATH contains.

You may have to add the Subversion folder to your PATH:

<?php
    $cmd = 'set PATH=%PATH%;"C:\Program Files\Subversion\bin\"; svn up';
    shell_exec( $cmd );
?>

Hopefully, setting the PATH will solve your problem.

Nick Presta
Those require you to install an svn module, which isn't possible in my environment.
Coltin
no, they don't, see my answer below.
dusoft
'set PATH' returns my path with the Subversion folder at the end. I tried for the heck of it adding the Subversion folder to the path again, but it didn't work. Thanks for trying to help though, I appreciate it.
Coltin
+1  A: 

use free svn classes instead, they don't require svn module: http://www.phpclasses.org/browse/package/3427.ht http://code.google.com/p/phpsvnclient/

dusoft
+1  A: 

I found this problem too and can solve this problem, make sure you use username and password (if need)

eg. svn update "\my\project\" --username [myusername] --password [mypassword]

If not, no output and svn still wait for you enter that.

P.S. When I log on and run svn on cmd, it not request username and password but when I run on PHP you need it. Hopefully, it will solve your problem.