Home > Backend Development > PHP Tutorial > 含泪跪求-php调用system命令,shell可以成功运行,通过浏览器却不行,该如何解决

含泪跪求-php调用system命令,shell可以成功运行,通过浏览器却不行,该如何解决

WBOY
Release: 2016-06-13 13:29:32
Original
977 people have browsed it

含泪跪求--php调用system命令,shell可以成功运行,通过浏览器却不行
$cmd="python 1.py -t a -f b";
system($cmd,$ret);
?>

这段代码,如果在shell里面直接用 php -f a.php ,ret可以成功返回0,但是通过浏览器访问的时候,1.py 执行不成功,ret返回1,各位大侠,这是怎么回事,我快崩溃了~~~~~

------解决方案--------------------
那是没有操作权限,在你的机子上装sudo,然后:
$cmd="sudo python 1.py -t a -f b"; //切换至root操作权限
------解决方案--------------------
如果是在linux下就是权限问题,运行命令行的是一个权限 web的是另外一个权限.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template