通过打开url的方式访问php脚本来通过执行popen()函数来执行svn更新

header("Cache-Control:no-cache,must-revalidate");
$handle = popen('svn --version','r'); 
$read = stream_get_contents($handle);
echo "<pre>";
printf($read);
echo "</pre>"; 
pclose($handle);

代码来源张宴N年前的博客:http://blog.s135.com/post/371/2/1/
这样在浏览器上访问输出的结果OK

svn, version 1.6.11 (r934486) compiled Apr 11 2013, 16:13:51

Copyright (C) 2000-2009 CollabNet. Subversion is open source software,
see http://subversion.tigris.org/ This product includes software
developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

  • ra_neon : Module for accessing a repository via WebDAV protocol using Neon.

    • handles 'http' scheme
    • handles 'https' scheme
  • ra_svn : Module for accessing a repository using the svn network protocol.

    • with Cyrus SASL authentication
    • handles 'svn' scheme
  • ra_local : Module for accessing a repository on local disk.

    • handles 'file' scheme

把第二行代码换成
popen('svn up --username zmk --password 123456 /home/wwwroot/test/','r');
就不行了(什么都不输出)。
如果把第二行代码换成
popen('svn up --username zmk --password 123456 /home/wwwroot/xxx/','r');
这里的/home/wwwroot/xxx是错误的地址,最终页面会输出
Skipped '/home/wwwroot/xxx'

求linux大神看看

现在这个脚本的用户组和用户是www:www

阅读 5.7k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题