Click to See Complete Forum and Search --> : executing system commands


dlaw
11-11-2004, 04:53 PM
Hi all,

I am trying to execute system commands on a Linux box using php but I am getting mixed responses. Basic commands work, such as "ls" and "ps", however higher commands do not, like "mkdir" or "perl". I get return values of either 0 (for ls, ps), 1 (eg for mkdir, emacs), and 127 for other programs like "transeq".

Here is an example:
$result = system("perl test.pl testing", $return);

From what I understand code 127 is "command not found" while I know code 0 is success and 1 unsuccessful. The wierd thing is when I try executing a perl script, I get a return code of "0" but the script itself is not run.

I do not use escapeshellcmd as none of the commands will be user specified.

My guess is that this is either a permission problem or a path problem. Is there a setting in php configuration (or apache) which affects this?

thanks in advance,
Dave

dlaw
11-11-2004, 06:41 PM
don't worry, got it.

Turns out I needed "/usr/local/bin/command" rather than "command".

:o