Re: exec from process (deamon) without shell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Roman Neuhauser <neuhauser@xxxxxxxxxx>:

# lists@xxxxxxxxxxx / 2007-03-01 18:28:35 +0200:
#/thepathtophp
<?php

exec("ls -lrt", $stdout, $exitcode);

if($exitcode!=0) {
echo "Command ls -lrt could not be executed correctly. Exit code: $exitcode\n";
} else {
            echo "Result:\n";
            foreach($stdout AS $line) {
                        echo $line."\n";
            }
}

?>


This code give the exit code -1 that is equal to that "ls -lrt" could not be
executed.

Does the daemon run chrooted somewhere?
What does $PATH contain?
What happens if you use /bin/ls?


I tried with /bin/ls but still same thing. I just found out that the exitcode is -1 but the $stdout actually gives correct answer. But that doesn't make sense. How can I then control what action to take depending on the exitcode?

apache   10099     1  0 18:47 ?        00:00:00 /tmp/log_monitor

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux