Crayl
Crayl

Reputation: 1911

PHP - How to run a script multiple times parallel

I want to run multiple instances of the following script parallel:

for($i = 0; $i < 1000; ) {
   echo "It works! Woohoo.<br/>";
   sleep(1);

   flush();
   ob_flush();
 }

I have included the httpd-mpm.conf in Apache's httd.conf, but it still doesn't work. I'am using WAMP with Windows7. Is there a way to get this working?

Thanks!

Upvotes: 0

Views: 534

Answers (2)

Jon Skarpeteig
Jon Skarpeteig

Reputation: 4128

PHP is single threaded, but there are some tricks to get multiple threads in order to offload heavy tasks to the background. One is to use Gearman, another is to use the new events introduced in PHP 5.4.

Upvotes: 3

Celeritas
Celeritas

Reputation: 15091

Don't use PHP use CGI or Java Servlets.

Upvotes: 0

Related Questions