Reputation: 1103
Here's the thing,
$file="myjpg.jpg";
$runme="/var/www/html/facedetect/facedetect ".$file;
$output=shell_exec($runme);
var_dump($output);
Turns
NULL
But in reality the exact same command run through ssh takes a little while to complete, about 15 seconds and it does return an output.
So I'm thinking that PHP isn't waiting and exits before that completes.
What can be done to fix this? any special setting in the ini, something.
Or is there a miss configuration somewhere that might be related for shell_exec not to send myjpg.jpg as the argument for the executable. I'm just clueless about this.
Upvotes: 1
Views: 1857
Reputation: 27603
shell_exec()
returns NULL
when the command fails; i.e. when it returns a none-zero exit value.
This is most probably the case.
To debug, try exec()
, which always returns a value, it will return the error.
My gut-feeling is that /var/www/html/facedetect/facedetect
or $file;
are not accessible by the user that runs PHP (probably www-data).
Upvotes: 2