1

I want to run more than 300 PHP script simultaneously in background. I tried using exec() one after another. But it runs sequentially. It means first it executes exec() first command then next exec() command. How can I run all PHP script in background at a time ? Current code :

exec("wget -O - http://mywebsite.com/index.php >/dev/null 2>&1");
exec("wget -O - http://mywebsite.com/index3.php >/dev/null 2>&1");
exec("wget -O - http://mywebsite.com/index4.php >/dev/null 2>&1");
exec("wget -O - http://mywebsite.com/index5.php >/dev/null 2>&1"); 

This script first executes index.php entirely and then executes index3,4,5. But I want to run all at a time. Any help would be appreciated.

Thank you!

Regards, John

8
  • you are using the wget so it will execute one by one you can use crontab command create a schedule job for all php file at one time where your current time would be now Commented Oct 9, 2015 at 7:10
  • Take a look at the nohup utility. Commented Oct 9, 2015 at 7:11
  • @bornprogrammer Any example would be fine. Commented Oct 9, 2015 at 7:25
  • Possible duplicate of php background process using exec function Commented Oct 9, 2015 at 7:34
  • 1
    @arkascha nohup is used to run in background not simultaneously... requirement is to run all php script simultaneously in background Commented Oct 9, 2015 at 7:45

1 Answer 1

0

You can look at using php-rescue for the purpose. celery-php can also work for you.

Sign up to request clarification or add additional context in comments.

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.