Php exec


#1

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 "
$output
"; ?>

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?


#2

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…


Somewhere, something incredible is waiting to be known.
Sagan


#3

Set commands to $var

<?php exec($var); ?>

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


#4

[quote]
Set commands to $var

<?php exec($var); ?>[/quote]

That did the trick, thank you.