I have StartServer.php file that basically starts a server if it is not already started. Everything works perfect except that the StartServer.php will hang forever waiting for the shell_exec()’d file Server.php to finish its execution that it never does.
Is there a way to execute a PHP file and just forget about it — and not wait for its execution to finish?
Edit: It has to work on Windows and Linux.
This should help you – Asynchronous shell exec in PHP
Basically, you
shell_exec("php Server.php > /dev/null 2>/dev/null &")