0

I have a very simple piece of code which should theoretically get me a svn list from php

<?php
print_r("Method 1<br/>");
$x = exec("/usr/bin/svn list svn+ssh://svn.server.com/path/to/trunk/ 2>&1", $o, $m);
print_r($o);

print_r("<br/><br/><br/>");

print_r("Method 2<br/>");
$x = exec("/usr/bin/svn list --username user --password pass svn+ssh://svn.server.com/path/to/trunk/ 2>&1", $o, $m);
print_r($o);
?>

Both these methods return following errors

Method 1
Array ( [0] => svn: warning: Can't open file '/root/.subversion/servers': Permission denied [1] => No protocol specified [2] => [3] => (gnome-ssh-askpass:6062): Gtk-WARNING **: cannot open display: :0.0 [4] => svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file. [5] => svn: Network connection closed unexpectedly ) 


Method 2
Array ( [0] => svn: warning: Can't open file '/root/.subversion/servers': Permission denied [1] => No protocol specified [2] => [3] => (gnome-ssh-askpass:6062): Gtk-WARNING **: cannot open display: :0.0 [4] => svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file. [5] => svn: Network connection closed unexpectedly [6] => svn: warning: Can't open file '/root/.subversion/servers': Permission denied [7] => No protocol specified [8] => [9] => (gnome-ssh-askpass:6066): Gtk-WARNING **: cannot open display: :0.0 [10] => svn: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file. [11] => svn: Network connection closed unexpectedly )

I am able to run either of the svn commands from command line just fine, I also have ssh-key based authentication setup to talk to the svn.server.com

All I want to do is get a list of folders from the trunk. our svn is only setup for svn+ssh access.

Any ideas?

4
  • I have a feeling that the php script executes the svn command as the user 'apache', who, I think does not have privilege to access the file /root/.subversion/servers. To verify my point you could test "whoami" command to check the user. Commented Aug 20, 2012 at 15:56
  • Though your way is simple, why not use PHP's svn functions? You could get the list with print_r(svn_ls('svn+ssh://svn.server.com/path/to/trunk/')) Commented Aug 20, 2012 at 16:20
  • @CoderaPurpa I think you're right, any suggestions on how I can get around that? I tried setting /root/.subversion/servers to chmod 777, but not difference. Commented Aug 20, 2012 at 20:04
  • @newfurniturey, I need to install svn extension through pear. Let me do that and I will certainly get back to you. Commented Aug 20, 2012 at 20:06

1 Answer 1

1

Your answer is here:

Calling an svn update from a php script via a browser is not working

  1. run a chmod 777 on .svn directory
  2. run an svn update via command line
  3. call script
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.