php执行python脚本问题

WBOY
Release: 2016-06-23 13:56:33
Original
1423 people have browsed it

    在设计界面时需要在界面上点击按钮,使得在php中调用python脚本,

<?php$host_ip=$_GET["IP"];$a="python /home/nessus/nessus_schedul/scan_schedul.py ".$host_ip."";echo $a;exec($a,$out,$states);print_r($out);print_r($states);?>
Copy after login
是php函数,命令"python /home/nessus/nessus_schedul/scan_schedul.py”在shell命令行可以执行,命令行执行php也是可以的,但是点击按钮在界面上就不可以执行,希望大侠们帮忙解决一下,小女子感激不尽啊。。。


回复讨论(解决方案)

    在设计界面时需要在界面上点击按钮,使得在php中调用python脚本,
PHP code
$host_ip=$_GET["IP"];
$a="python /home/nessus/nessus_schedul/scan_schedul.py ".$host_ip."";
echo $a;
exec($a,$out,$states);
print_r($out);
print_r($states);
?>
是php函数,命令[code=php ]python /home/nessus/nessus_schedul/scan_schedul.py[/code]在shell命令行可以执行,命令行执行php也是可以的,但是点击按钮在界面上就不可以执行,希望大侠们帮忙解决一下,下女子感激不尽啊。。。

可以看下php.ini是不是把exec给禁用了
disable_functions

python文件的权限?

echo $a;是否可以输出。



小女子~

web服务器用的用户路径里可能没有python。python写上绝对地址试试

py脚本还是放在网站的目录下

2L的答复对我有用,多谢。

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