php - Continuing through loop without having to wait foreach file to load -
i'm using for
loop speed script. problem each process happens within of loop takes several minutes load. possible move on next sequence in loop if previous 1 hasn't completed? know php isn't multi-threaded language, perhaps python improve choice.
ini_set('memory_limit', '2048m'); ini_set('max_execution_time', 0); $list = file_get_contents('auth.txt'); $list = nl2br($list); $exp = explode('<br />', $list); $count = count($exp); for($i=0;$i<$count;$i++) { $auth = $exp[$i]; echo 'trying '.$auth.' \n'; // takes several minutes. possible move on next 1 before has completed? exec('python test.py --auth='.$auth); }
use &
run script in background:
exec('python test.py --auth='.$auth . ' > /dev/null 2>&1 &');
php loops
No comments:
Post a Comment