Reputation: 11225
I'm trying to return a process ID throw a php.
In Linux this command return Process ID
/receive.sh url=http://www.site.com cert=certs/test_lv.p12?test_lv > /dev/null 2>/dev/null &
I need to run this command throw a php.
$response2 = shell_exec("./receive.sh url=https://www.site.com cert=certs/test.p12?test_lv > /dev/null 2>/dev/null &");
echo $response2;
It's returned an empty string. Thanks for answers!
Updated* I added an ouput PID and it works! Thanks to all!
./receive.sh url=https://www.site.com cert=certs/test_lv.p12?test_lv > /dev/null 2>/dev/null & echo $!
Upvotes: 0
Views: 2795
Reputation: 779
shell_exec returns the output stream. Your command may print the process id to the error stream and that's why you get an empty string.
Here you can see how to print the error stream. I am not sure if that's your case but give it a try.
Upvotes: 1
Reputation: 3912
I think you code has a bug since it already redirects the output to /dev/null in your command , just try to remove the output redirection and it may work
Upvotes: 1