在php中运行的python脚本没有输出

时间:2015-03-11 22:42:58

标签: 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/installer.py包含以下内容:

#!/usr/bin/python
print '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;
                  }
       }

任何人都能帮我解决我所缺少的问题吗?

谢谢!

0 个答案:

没有答案