Nie testowałem, ale może można spróbować dodać "&" do parametru "exec", np
$cmd = "/path/to/file";
W normalnym uniksie powoduje to wywołanie programu w tle. A jak wiemy, exec czeka na wykonanie się polecenia. No to poczeka tylko chwileczkę, dopóki shell nie zamelduje mu, że polecenie się wykonało. A że w tle? Chyba o to Ci chodzi.
Spróbuj,potestuj, daj znać.
aha, notka z manuala do exec:
Kod
Note: If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.
Reasumując, powinno być chyba bardziej tak:
Kod
$cmd = "/path/to/file";
$background = ">/dev/null 2>/dev/null &";
exec ($cmd . $background);
Oczywiście, redirectowanie standard output/error możesz dać do pliku, jeśli chcesz/potrzebujesz. Ja dałem do /dev/null, bo zakładam, że nie interesuje Cię to co program ewentualnie wypluwa (albo wręcz jest tak, że nie wypluwa nic).