Re: what permissions are needed to let a php script call the "svn update" subversion command?
- From: Jake Barnes <lkrubner@xxxxxxxxxxxxx>
- Date: Mon, 15 Dec 2008 21:53:18 -0800 (PST)
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?
.
- Follow-Ups:
- References:
- Prev by Date: How to set pseudo terminal non-blocking?
- Next by Date: apache mod_rewrite question - remove one directory from the URL
- Previous by thread: Re: what permissions are needed to let a php script call the "svn update" subversion command?
- Next by thread: Re: what permissions are needed to let a php script call the "svn update" subversion command?
- Index(es):
Relevant Pages
|