exec()函数不规则svn checkout(exec() function doesn't rule svn checkout)

编程入门 行业动态 更新时间:2024-10-21 17:41:44
exec()函数不规则svn checkout(exec() function doesn't rule svn checkout)

我正在使用exec()在php中编写一些函数来查询svn。

The commands exec("svn list ".$myurl) works.

现在,我尝试使用checkout命令在svn存储库上获取路径。 当我将命令“svn checkout http://core.wordress.org/tags/2.9.2/ last-version”直接放在控制台中时,它可以工作。

但是,当我使用exec()从php脚本执行此操作时,如下所示:

exec("svn checkout ".$myurl, $dir)

它不起作用。

你有个主意吗?

I'm writing some functions in php using exec() to interrogate a svn.

The commands exec("svn list ".$myurl) works.

Now, I try to get a path on a svn repository with the checkout command. When I put the command "svn checkout http://core.wordress.org/tags/2.9.2/ last-version" directly in the console, it works.

But when I do this from a php script using exec(), like this :

exec("svn checkout ".$myurl, $dir)

it doesn't work.

Have you an idea ??

最满意答案

这可能有多种原因。

不允许在其下运行的用户PHP写入您要签入的目录

SVN存储库需要为PHP运行的用户缓存的登录凭据

SVN签出过程开始,但需要一些额外的输入,如可怕的“你想接受此证书”与未签名的证书。

尝试在命令中添加2>&1将stderr重定向到stdout,然后查看$dir 。 还可以使用$return_var参数来执行exec() 。

正如Jacob指出的那样,总是使用escapeshellargs()作为命令参数。

This can have a variety of reasons.

The user PHP runs under is not allowed to write into the directory you want to check out into

The SVN repository requires login credentials that are not cached for the user PHP runs under

The SVN checkout process starts, but requires some additional input like the dreaded "Do you want to accept this certificate" with unsigned certificates.

Try adding 2>&1 to the command to redirect stderr to stdout, and take a look at $dir. Also make use of the $return_var parameter to exec().

And as Jacob pointed out, always use escapeshellargs() for your command arguments.

更多推荐

本文发布于:2023-08-07 08:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463776.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不规则   函数   exec   svn   rule

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!