0

我有一段非常简单的代码,理论上应该让我从 php 获得一个 svn 列表

<?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);
?>

这两种方法都返回以下错误

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 )

我可以从命令行运行任何一个 svn 命令就好了,我也有基于 ssh-key 的身份验证设置来与 svn.server.com 对话

我想做的就是从主干获取文件夹列表。我们的 svn 仅用于 svn+ssh 访问。

有任何想法吗?

4

1 回答 1

1

你的答案在这里:

通过浏览器从 php 脚本调用 svn update 不起作用

  1. 在 .svn 目录上运行 chmod 777
  2. 通过命令行运行 svn update
  3. 调用脚本
于 2013-07-24T10:07:52.953 回答