PHP exec: hangs, does not continue until the next line

I have a php file "run.php" that I run from the terminal. Inside this file, I have the following lines:

exec ("open-crawlers $ port 2> & 1", $ out, $ code); echo 'hello';

The problem I encountered is that the terminal freezes after executing the "exec" command; the program does not reach the second line.

+4
source share
1 answer

Try the following:

exec("nohup open-crawlers $port >> /tmp/log_file.log 2>&1 &"); echo 'hello'; 
+12
source

All Articles