Answer the question
In order to leave comments, you need to log in
How to run multiple scripts in parallel from PHP under Windows Openserver?
Good afternoon!
You need to run N scripts once in a certain time interval, depending on the execution of the 1st script in the queue.
1st script is executed - determines how many scripts (threads) to run. Further, based on these data, you need to run N scripts with a slight delay.
How to do it? Redirect the 1st script to start threads with a variable or something like that, I don’t understand. Now I manually run all these streams through PHPSTORM and it's wildly inconvenient.
Answer the question
In order to leave comments, you need to log in
Decided as follows:
1. Script1 is launched by cron, works out and writes the result of its execution to a txt file (for logging and not only).
2. Script1 includes Script2, which launches the required number of scripts via a COM object (it was not possible to implement it in another way):
$com = new Com('WScript.shell');
$start_times = 10; // how much times to start
$go = 'script.php'; //scriptname
for ($i = 0; $i < $start_times; $i++) {
$com->run('php C:\OpenServer\domains\scripts.loc\' . $go . ' 2>&1', 0, false); //2ой параметр положительный чтобы консоль видимой была
}
exec("php C:\\OpenServer\\domains\\scripts.loc\\www\\exec.php 50 3 7 2>&1");
Look here or in similar solutions https://github.com/mitalcoi/yii2-cronjobs/blob/mas...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question