Is there a way to use shell_exec without waiting for the command to complete?
You can also give your output back to the client instantly and continue processing your PHP code afterwards.
This is the method I am using for long-waiting Ajax calls which would not have any effect on client side:
ob_end_clean();ignore_user_abort();ob_start();header("Connection: close");echo json_encode($out);header("Content-Length: " . ob_get_length());ob_end_flush();flush();// execute your command here. client will not wait for response, it already has one above.
You can find the detailed explanation here: http://oytun.co/response-now-process-later