通过打开url的方式访问php脚本来通过执行popen()函数来执行svn更新
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了通过打开url的方式访问php脚本来通过执行popen()函数来执行svn更新,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2720字,纯文字阅读大概需要4分钟。
内容图文
header("Cache-Control:no-cache,must-revalidate");
$handle = popen('svn --version','r');
$read = stream_get_contents($handle);
echo "";
printf($read);
echo "
";
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
回复内容:
header("Cache-Control:no-cache,must-revalidate");
$handle = popen('svn --version','r');
$read = stream_get_contents($handle);
echo "";
printf($read);
echo "
";
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
参考php手册上面的代码,才看出来问题所在。
在下面也自问自答了,这里就不再粘贴复制了,直接链地址吧。
希望对其他遇到同样问题的朋友有所帮助!
http://stackoverflow.com/questions/21870660/access-a-phpscript-through-the-browser-to-execute-the-function-of-popen-som
内容总结
以上是互联网集市为您收集整理的通过打开url的方式访问php脚本来通过执行popen()函数来执行svn更新全部内容,希望文章能够帮你解决通过打开url的方式访问php脚本来通过执行popen()函数来执行svn更新所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。