Re: exec from process (deamon) without shell
| From: | lists at dwsasia dot com | Date: | Thu, 01 Mar 2007 18:56:03 +0000 |
| Subject: | Re: exec from process (deamon) without shell | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249666@lists.php.net to get a copy of this message | ||
Quoting Roman Neuhauser <neuhauser@sigpipe.cz>:
# lists@dwsasia.com / 2007-03-01 18:28:35 +0200: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?#/thepathtophp <?php exec("ls -lrt", $stdout, $exitcode); if($exitcode!=0) {Does the daemon run chrooted somewhere? What does $PATH contain? What happens if you use /bin/ls?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.
apache 10099 1 0 18:47 ? 00:00:00 /tmp/log_monitor