Hi,
I have a very complex script that is being called by a running deamon that
doesn't have any shell. To simplify it I make this script, that is also
failing:
#/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.
Running this from shell give correct result.
Executing it from a web page (thru apache) gives correct result.
But the "shell less" deamon is giving the -1 exit code.
Is exec requiring a shell? Any workaround on this? I will play around, maybe
something like system() or passthru() will do it, but I haven't tested that
yet, want to get some feedback first.
Best regards,
Peter Lauri
<http://www.dwsasia.com/> www.dwsasia.com - company web site
<http://www.lauri.se/> www.lauri.se - personal web site
<http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free