You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Иван Чернявский <ca...@yandex.ru> on 2008/01/09 12:12:38 UTC

reason and workaround for Can't open file '/root/.subversion/servers' problem

Hi all,



as there are several places in the web where problem with above error message is described (usually when dealing with Subversion from inside an PHP script), I've deciced to post my findings here --- maybe they will help someone. If this was already written somewhere --- sorry! When I've encountered this problem myself, I didn't found any.



The problem --- in short: When trying to call executable 'svn' with any params from PHP script, you may encounter message like following in your web server log (and of course command is not executed):



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



This is very confusing as usually web servers (e.g. Apache) are run not as root, but as 'nobody' or 'daemon' or 'www' etc. So why root is here?!..



I performed 'set' from the same script and it appeared the reason was simple: $HOME environment variable was set to /root!! So it seems, Apache is starting as root and then changing to requested user, but somehow $HOME is not changed.



Obvious workaround is to use command like this:



  $cmd_string = 'export HOME=/var/lib/nobody; ' . $svn_command;



where /var/lib/nobody is just an example (this is usual home dir for user 'nobody') and $svn_command is the command you needed to execute.



As I remember, I've encountered the same problem using SVN extension for PHP, so probably should also post to http://pecl.php.net/package/svn...



Kind regards,

   Ivan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org