在php中运行的python脚本没有输出
在运行“php file.php”的终端中,以下脚本按预期输出文本在php中运行的python脚本没有输出,php,python,curl,nginx,Php,Python,Curl,Nginx,在运行“php file.php”的终端中,以下脚本按预期输出文本 <?php $command = escapeshellcmd("python /root/installer.py"); $output = shell_exec($command); echo $output; ?> # php /usr/share/zabbix/rackspace/index.php test 但是如果我卷曲这个页面,就不会有输出,也不会有错误 [root@http-1 ~]# curl
<?php
$command = escapeshellcmd("python /root/installer.py");
$output = shell_exec($command);
echo $output;
?>
# php /usr/share/zabbix/rackspace/index.php
test
但是如果我卷曲这个页面,就不会有输出,也不会有错误
[root@http-1 ~]# curl fake.url.com
[root@http-1 ~]#
我的nginx在此页面的配置如下:
server {
listen [::]:80;
listen 80;
server_name fake.url.com;
access_log /var/log/nginx/installer.log main;
root /usr/share/zabbix/url/;
index index.php index.htm index.html;
error_page 404 /404.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
有人能帮我做点什么吗
谢谢 确保nginx的用户具有对“/root/installer.py”的执行访问权限。我已经做了/root/installer.py 777,但仍然没有任何错误。检查nginx日志是否有任何错误。
server {
listen [::]:80;
listen 80;
server_name fake.url.com;
access_log /var/log/nginx/installer.log main;
root /usr/share/zabbix/url/;
index index.php index.htm index.html;
error_page 404 /404.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}