0

My nearish psuedo code: -

for ($i = 1; $i < 5; $i++) {
exec("C:\wamp\www\googletodaybatch.bat");
echo $i;
}

The bat file contains the following: -

START C:\wamp\bin\php\php5.5.12\php.exe -f "C:\wamp\www\googletoday-task.php" 

I want to use this way instead of include file as I need it to start 5 instances of the task. Each instance takes 2 mins. So I don't want it to wait. It updates many databases all at the same time.

Do I use "exec" or "shell_exec"?

Summary: - Instead of having many lines in my bat file that are all the same, I want one line running many times using a loop from PHP.

Help please! The code above seems to just keep loading and never stops....

Mikeys4u
  • 1,494
  • 18
  • 26

1 Answers1

0

Use just a batch file to start the five tasks

for /l %%a in (1 1 5) do (
    START "" "c:\wamp\bin\php\php5.5.12\php.exe" -f "C:\wamp\www\googletoday-task.php" 
)

And here you will find the exec vs shell_exec information.

Community
  • 1
  • 1
MC ND
  • 69,615
  • 8
  • 84
  • 126
  • This is great for the batch file, but maybe I should have added - it needs to run for each distinct client in the database (i.e. 5), therefore I would need to update the batch file each time. – Mikeys4u Aug 01 '14 at 12:09
  • 1. The Php get how many companys there are and passes this number to the batch file somehow.... – Mikeys4u Aug 22 '14 at 08:34