php exec

php exec

Posted by: Blaubaer
Posted on: 2009-01-12 16:48:00

Hi!

I'm having trouble executing a shell script from php. The strange thing is that I'm not getting any errors, just nothing.

So for testing, I created the following php file:

<?php
$output = shell_exec('ls -ls');
echo "<pre>$output</pre>";
?>

If I open that page in my browser I only get a 404 error (probably because the php interpreter doesn't output anything).

system and exec won't work either. Is program execution from within php disabled?


Re: php exec

Posted by: vicm3
Posted on: 2009-01-12 17:25:00

DH uses mod_security... and I believe that a lot of calls to normal shell commands will not be allowed, in fact not really sure about shell_exec in first place...


Re: php exec

Posted by: sXi
Posted on: 2009-01-12 22:23:00

Set commands to $var

<?php
exec($var);
?>




How To Install PHP.INI / ionCube on DreamHost

Re: php exec

Posted by: Blaubaer
Posted on: 2009-01-12 23:20:00

In reply to:


Set commands to $var

<?php
exec($var);
?>



That did the trick, thank you.

Edited by Blaubaer on 01/12/09 11:21 PM (server time).

Tags: shell scriptstrange thingphp fileexec