Invoking svn update from php script via browser not working

I have two scenarios.

  • start the update and call shell_exec ('svn update') and shell_exec ('svn st')
  • running mysqldump shell_exec ('mysqldump params')

Update command is not executed in svn script svn st- print results but notsvn update

I tried to declare the parameters when calling svn update, for example, 'svn update'. dir. '- username myuser --password mypasswd --non-interactive'; - nothing yet. Plays with most options

If this has something to do with binaries / permissions / groups, I don't see this. The mysqldump command works fine and creates a file, so why doesn't svn update the file system?

Please, it is not recommended to use SVN base classes in PHP. This is not an option, I do not have full control over the server, and the module is not available.

Thank you for your help,

-hbt

PS: the important thing that is mentioned here. Scripts work when called from the command line. This only happens when called through a web browser.

+3
source share
6 answers

OK I understood. This is a permissions issue. The .svn directory must have the correct permissions because the svn update command uses these directories to write material.

So! --- Make sure you execute all chmod commands as sudo or root ----

  • run chmod 777 in the .svn directory
  • run svn update via command line
  • script

. chmod 777 .svn, svn

?

, svn- svn, , svn ( ) , , script, .

?

chmod 777 -R * svn

, , . , 777 , - .

.

+1

, .

, :

<?php
echo shell_exec('2>&1 svn update /path/to/checked/out/directory/ --non-interactive');

, :

svn: warning: Can't open file '/root/.subversion/servers': Permission denied
svn: OPTIONS of 'http://my.svn.server/svn/project/trunk': authorization failed: Could not authenticate to server: rejected Basic challenge (http://my.svn.server)

, - /root, - , -config-dir svn up:

<?php
echo shell_exec('2>&1 svn update /path/to/checked/out/directory/ --non-interactive --config-dir /path/to/my/home/.subversion');

* , /path/to/my/home/.subversion ,

+3

PECL svn? shell_exec.

+1

:

shell_exec('2>&1 svn update')

, 2>&1

+1

, .svn.

, , PHP ( apache), chmod - 775.

+1

: script, -, , svn, . svn status, svn update ( "svn: .svn/lock ': Permission denied" ).

0

Source: https://habr.com/ru/post/1747938/


All Articles