shell_exec没有显示任何PHP

时间:2021-06-08 00:05:27

I have a new install of Ubuntu Server 12. What I'm trying to do is execute the landscape-info command on a php webpage residing on the server so I can use the data returned but it won't run for some reason. I've checked apache works as I can see webpages from the servers IP address and checked safe mode is turned off using phpinfo() but it still fails to display anything. I've never ran apache myself and have little linux experience. Any ideas what could be causing this or what to check? Thanks.

我有一个新安装的Ubuntu Server 12.我想要做的是在驻留在服务器上的php网页上执行landscape-in​​fo命令,这样我就可以使用返回的数据,但由于某种原因它不会运行。我已经检查过apache工作,因为我可以看到来自服务器IP地址的网页,并且使用phpinfo()关闭了检查安全模式,但它仍然无法显示任何内容。我自己从来没有运行过apache并且没有Linux经验。什么可能导致这个或什么检查的想法?谢谢。

<?php
$output = shell_exec('../../usr/bin/landscape-sysinfo');
echo "$output";
?>

edit:

编辑:

changed to :

变成 :

<?php
$output = shell_exec('/usr/bin/landscape-sysinfo');
echo $output;
?>

looking in apache error.log I've found a lot of :

看着apache error.log我发现了很多:

    OSError: [Errno 13] Permission denied: '/var/www/.landscape'
Traceback (most recent call last):
  File "/usr/bin/landscape-sysinfo", line 22, in <module>
    run(sys.argv[1:], reactor)
  File "/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.py", line 96, in run
    setup_logging()
  File "/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.py", line 83, in setup_logging
    os.mkdir(landscape_dir)
  File "/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.py", line 83, in setup_logging
    os.mkdir(landscape_dir)

1 个解决方案

#1


1  

It seems the directory /var/www/.landscape does not exists or is not writable. Run this in the terminal:

似乎目录/var/www/.landscape不存在或不可写。在终端中运行:

mkdir -p /var/www/.landscape && chmod -R og+rwX /var/www/.landscape

That will make the required directory with no error if it already exists and then will change its permissions, recursively, to be readable/writable for everyone, and if it has any sub-directories they'll be accessible as well..

这将使所需目录没有错误(如果它已经存在)然后将递归地更改其权限,使其对每个人都是可读/可写的,如果它有任何子目录,它们也可以被访问。

#1


1  

It seems the directory /var/www/.landscape does not exists or is not writable. Run this in the terminal:

似乎目录/var/www/.landscape不存在或不可写。在终端中运行:

mkdir -p /var/www/.landscape && chmod -R og+rwX /var/www/.landscape

That will make the required directory with no error if it already exists and then will change its permissions, recursively, to be readable/writable for everyone, and if it has any sub-directories they'll be accessible as well..

这将使所需目录没有错误(如果它已经存在)然后将递归地更改其权限,使其对每个人都是可读/可写的,如果它有任何子目录,它们也可以被访问。