Add a nice clean line to the end of your PHP scripts: exit 0; //exit cleanly If your PHP scripts' last function call returns, say, -1, and then PHP just passes that back on out, it's probably going to look like an error code to the outermost shell, if you see what I mean... I'm not promising this is how it actually works; this is just a theory. Thu, March 1, 2007 5:12 pm, lists@xxxxxxxxxxx wrote: > 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? >> >> >> -- >> How many Vietnam vets does it take to screw in a light bulb? >> You don't know, man. You don't KNOW. >> Cause you weren't THERE. http://bash.org/?255991 >> > > Becuase this only is having problems when executing from the deamon I > added: > > exec("php -i", $stdout, $exitcode); > > And then put it into a logfile. Is there anything here that makes > $exitcode for all commands executed -1, but they still seams to be > functional as $stdout is as expected: > > > 2007-03-02 00:00:54 Environment > 2007-03-02 00:00:54 > 2007-03-02 00:00:54 Variable => Value > 2007-03-02 00:00:54 TERM => xterm > 2007-03-02 00:00:54 PATH => > /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/bin > 2007-03-02 00:00:54 _ => /usr/bin/php > 2007-03-02 00:00:54 PWD => /var/www/util > 2007-03-02 00:00:54 LANG => C > 2007-03-02 00:00:54 SHLVL => 6 > 2007-03-02 00:00:54 > 2007-03-02 00:00:54 PHP Variables > 2007-03-02 00:00:54 > 2007-03-02 00:00:54 Variable => Value > 2007-03-02 00:00:54 _SERVER["TERM"] => xterm > 2007-03-02 00:00:54 _SERVER["PATH"] => > /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/bin > 2007-03-02 00:00:54 _SERVER["_"] => /usr/bin/php > 2007-03-02 00:00:54 _SERVER["PWD"] => /var/www/util > 2007-03-02 00:00:54 _SERVER["LANG"] => C > 2007-03-02 00:00:54 _SERVER["SHLVL"] => 6 > 2007-03-02 00:00:54 _SERVER["PHP_SELF"] => > 2007-03-02 00:00:54 _SERVER["SCRIPT_NAME"] => > 2007-03-02 00:00:54 _SERVER["SCRIPT_FILENAME"] => > 2007-03-02 00:00:54 _SERVER["PATH_TRANSLATED"] => > 2007-03-02 00:00:54 _SERVER["DOCUMENT_ROOT"] => > 2007-03-02 00:00:54 _SERVER["REQUEST_TIME"] => 1172786454 > 2007-03-02 00:00:54 _SERVER["argv"] => Array > 2007-03-02 00:00:54 ( > 2007-03-02 00:00:54 ) > 2007-03-02 00:00:54 > 2007-03-02 00:00:54 _SERVER["argc"] => 0 > 2007-03-02 00:00:54 _ENV["TERM"] => xterm > 2007-03-02 00:00:54 _ENV["PATH"] => > /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/bin > 2007-03-02 00:00:54 _ENV["_"] => /usr/bin/php > 2007-03-02 00:00:54 _ENV["PWD"] => /var/www/util > 2007-03-02 00:00:54 _ENV["LANG"] => C > 2007-03-02 00:00:54 _ENV["SHLVL"] => 6 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php