I have a lengthy script that prevents other processes from running while it does not finish.
As a workaround, I decided to create a file that executes it with the exec ( mkt-start.php ) command. So:
exec('php -f mkt-exec.php > mkt.log &');
O & (and commercial) is for the mkt-exec.php file to run in the background, so the browser does not wait for the end of the execution.
However, the result of mkt.log is mkt.start.php itself and not mkt-exec.php , resulting in an infinite loop of executions. / p>
When I execute the command by the shell ( php -f mkt-exec.php > mkt.log &
) it works correctly.
Does anyone know why this behavior?
Obs : The result is the same if you put the full path of the file and / or the full php path.