Using PHP on Linux, I\'d like to determine whether a shell command run using exec() was successfully executed. I\'m using the return_var parameter to check for a successful
Not using the exec() method. When you send a process to the background, it will return 0 to the exec call and php will continue execution, there's no way to retrieve the final result.
pcntl_fork() however will fork your application, so you can run exec() in the child process and leave it waiting until it finishes. Then exit() with the status the exec call returned. In the parent process you can access that return code with pcntl_waitpid()