Billy2mates
Billy2mates

Reputation: 49

PHP process takes a long time to finish, how can I farm it off to a worker

I have a lot of calculations to do on a single thread (request/response). How can I multi-thread this work?

Upvotes: 1

Views: 110

Answers (3)

Joe Watkins
Joe Watkins

Reputation: 17148

PHP CAN MULTITHREAD

pthreads is not an interface to Posix Threads, but an Object Orientated Threading API for PHP 5.3+

http://php.net/pthreads

That is not to say that it is a good idea to create threads in direct response to a web request, but as a matter of fact; PHP can multithread.

Upvotes: 1

just somebody
just somebody

Reputation: 19247

Upvotes: 0

Eddie Jaoude
Eddie Jaoude

Reputation: 1708

PHP cant multi-thread, it can fork - but only when not going through apache!

Look at using a Worker system, like PHP-Resque

It makes life so much easier :)

Upvotes: 1

Related Questions