tags:

views:

42

answers:

2

Hi I want to write a php script which updates svn working directory

I tried with below code , but it does not work.I guess because the USER for php script is "apache" but for svn update it needs to be "homeuser"

    putenv("USERNAME=homeuser");
    putenv("HOME=/home/homeuser");  

    exec("svn update /home/homeuser/path/to/working/dir", $info); //svn update with full path

    print_r($info);

how to get around ?

+2  A: 

First, it seems like a bad idea to have a PHP script do this. But anyway, if you must - you could try creating a shell script to do the svn update and then use the PHP system function to execute that script.

Justin Ethier
You'll still have the same permission issue. Your custom script will execute as apache so any commands it executes will also be as apache.
Peter Bailey
+1  A: 

There's nothing you'll be able to do with PHP to fix this - it's all in the *nix permissions.

The "apache" user will need to be given permission to execute svn update.

Peter Bailey
"The "apache" user will need to be given permission to execute svn update." how to do this ??
Sourabh
I'd answer that but I'm not a server admin guy. Perhaps open a new question on ServerFault or SuperUser?
Peter Bailey