burg93
burg93

Reputation: 163

shell_exec not displaying anything PHP

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.

<?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 :

    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)

Upvotes: 0

Views: 630

Answers (1)

Grigor Yosifov
Grigor Yosifov

Reputation: 1474

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

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..

Upvotes: 1

Related Questions