Re: what permissions are needed to let a php script call the "svn update" subversion command?



On Dec 11, 7:47 pm, Jake Barnes <lkrub...@xxxxxxxxxxxxx> wrote:
If I log into my server as root, I can easily run this line:

/usr/bin/svn update /home/www/contentingester  --username lkrubner --
password xxxxxxxx

But when I put it in a PHP script  this does not work (and by that
mean, the command "svn update" seems to never be called):

$results =  shell_exec("/usr/bin/svn update /home/www/contentingester
--username lkrubner --password
xxxxxxxx");

        echo "
                <pre>
                        The results:

                        $results
                </pre>
        ";

Is this likely a permission issues? Or a path issue? Or is there some
reason I just can't call this through shell_exec()?

There are no errors about this in the PHP error log.

I assumed this was a permissions issue, but I can't quite figure out
the right permissions. I chmoded everything in the working copy to
0777, but that didn't help. Then I chmoded /usr/bin/svn to 0777. Still
it doesn't work.

Just to be very, very clear, I mean the PHP script runs but shell_exec
seems to not work. If I put this script file on the server in a place
that can be accessed
from the web, and If I then point my browser at it, then I can see the
words "the results" but the variable $results is empty. More so, if I
look at the files that were suppose to be updated, I can see that the
"svn update" command never run. If, at that point, I log into the
server as root and run this line:

/usr/bin/svn update /home/www/contentingester --username lkrubner --
password xxxxxxxx

then the files under version control are correctly updated. But when I
try to trigger that same command using shell_exec(), it is as if "svn
update" never runs.


On another forum, someone suggested to me that I explore the
possibility of a permissions problem, by running this command:

sudo -u apache bash

So now I'm the apache user, interacting with the bash shell. So then I
do this:

/usr/bin/svn update /home/www/contentingester --username lkrubner --
password xxxxxx

and I get this error:

svn: Can't open file '/root/.subversion/servers': Permission denied

So, apparently, the problem my PHP script has when it calls shell_exec
() is that it doesn't have permission to read from /root/.subversion/
servers ?

But if I exit out of the interactive shell (so that I am once again
root, rather than the user apache) and check the permissions, anyone
can read that file:

ls -l /root/.subversion/servers

-rw-r--r-- 1 root root 3270 Dec 8 11:37 /root/.subversion/servers

So the user apache has read rights. So what is the problem? Is the
problem that the /root directory can only be read by root? (I checked,
and, of course, /root is not world readable.) If so, how do I get
around this problem?



.



Relevant Pages

  • Re: what permissions are needed to let a php script call the "svn update" subversion command?
    ... Just to be very, very clear, I mean the PHP script runs but shell_exec ... "svn update" command never run. ... to commit their work to Subversion. ...
    (comp.unix.programmer)
  • Re: i cant call subversion from php with shell_exec()
    ... But when I put it in a PHP script ... "svn update" command never run. ... But "svn update" does not work. ...
    (comp.lang.php)
  • Re: ubuntu-users Digest, Vol 47, Issue 208
    ... Superuser confusion or maybe critically confused ... "Permissions" appears nowhere in Nautilus, so far as I can tell. ... I am attempting to learn to use command line. ...
    (Ubuntu)
  • Re: write with cURL
    ... potential security risks from other users on the same server. ... as the global web server user and thus needs world write permissions ... Hence, any PHP script ran on another account, has the ... Correct, not the same as global write, just the same Apache group write. ...
    (alt.php)
  • Re: Isolate home directory shares
    ... I believe the command for one subfolder would be similar to: ... removes the inheritance flag but leaves existing permissions for the ... home directories are done with ADUC using profile tab: ...
    (microsoft.public.windows.server.general)