开发者

PHP - Running exec multiple php files

I'm running a curl script that does data mining; for it to run through all date it takes approx 600 seconds. So I figured, If I split the load with two or three or etc... threads, I could then split that 600 seconds.

Any suggestions?

I know one way to do this is via windows scheduler, I can have it execut开发者_运维百科e multiple files; but ideally I'd like to have windows scheduler execute (i.e. php-cgi thefilename.php) one single file and have that one exec multiple others.

Any suggestions? THanks,


If you're stuck on windows, i.e. you don't have the pcntl extension, what I would recommend is to use curl_multi_* to execute multiple requests asynchronously. This is a good way to get more performance if your bottleneck is the server delays.


Not really answering your question but a solution nevertheless. You could create a batch file like this:

start php-cgi thefilename.php
start php-cgi thefilename.php
start php-cgi thefilename.php

This will create three independent threads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜