Subversion issue via PHP exec

I can run the svn command from the command line, but not from a PHP script. It is noteworthy that I can run the PHP script on my Mac and it returns the expected data just fine, but when I upload it to my Linux server, it will not work (from within PHP ... I can run the svn command from Terminal). I am sure this is a problem with the user or permission.

I can run (from the command line):

svn log http://whatever.com/svn/foo

but none of the following works (performed separately ... not all together):

exec('svn log http://whatever.com/svn/foo');
exec('svn log http://whatever.com/svn/foo',$out);
exec('/usr/bin/svn log http://whatever.com/svn/foo');

However, this works:

exec('ls');

I assume the problem is that when I start from the command line, I start it as root, whereas when I start with PHP, I start as apache (www-data) user? May be? Any suggestions on how to run it ?exec('svn log http://whatever.com/svn/foo');

777 ( !) .

+3
3

, , , :

1 (, ):

$cmd = '/usr/bin/svn list --config-dir /some/place file:///var/subversion/devfoundry/ 2>&1';
exec($cmd, $output); 
$output = implode("\n", $output) . "\n";
echo $output;

2:

Subversion "svn: Can not " .

<?php
    putenv('LANG=en_US.UTF-8');
?>

( ) shell_exec()

3: PHP

+2

Subversion , . .

Php -, , Apache httpd ( "apache", "www", "runwww" .. ). , PHP script, Subversion.

:

  • --username --password.
  • httpd Subversion. , . , PHP- .
+3

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


All Articles