0

Okay I have 50 php scripts each of which will take 20 days to finish I want to write a PHP script to run these 50 scripts simultaneously I did use exec() function in my script but the problem is it runs first script and wait until it is finished before executing the next script. I want to run all of them in parallel.Is there any way to do that? Thanks

1

3 Answers 3

1

Okay thanks I got my answer after a lot of search

Apart from adding a &, you also need to redirect output to somewhere - otherwise your php process waits until the other process finished, because there could be more output:

exec('/path/to/program & > /dev/null 2>&1')
Sign up to request clarification or add additional context in comments.

Comments

0

You put a & between scripts

php /var/www/script1.php & php /var/www/script2.php ........

Comments

0

if have to use only php, more "php'iish" way to do this is Robo (https://robo.li) it is used with codeception, for example.

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.