9

I have a php file 'run.php' which I'm running from the terminal. Within this file I have the following lines:

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

The problem that I'm having is that the terminal hangs after executing the 'exec' command; the program doesn't reach the second line.

1
  • 1
    What happens when you execute it on the command line yourself? Commented Sep 14, 2011 at 10:55

2 Answers 2

17

Try this:

exec("nohup open-crawlers $port >> /tmp/log_file.log 2>&1 &");
echo 'hello';
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. Your answer inspired my solution,this command worked for me: exec("open-crawlers $port >> error.txt 2>&1 &",$out,$code);
Just a comment in case someone else has the problem I did. You have to both pipe the output to a file as well as the appended "&". If you don't pipe the output, it will hang. Just pipe to /dev/null if you don't care about it.
Love you : ) : )
0

If you are here using StormPHP and xdebug:

Raise your "settings/debugger/max simulatanious connections"

e.g.: from 3 to 5

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.