Php – To use thread safe or non thread safe PHP

apache-2.2iisPHP

i wonder which is better to use? i read somewhere thread safe is for multithreading and is faster. then shldnt php just release a thread safe php? why release a lousier version of software. so my question is since they release different versions, there must be a difference. so whats it?

from here

This new FastCGI handler from
Microsoft enables you to configure the
non thread safe PHP binaries in
FastCGI mode, which is one massive
shot in the arm for performance.
Easiest way to put it is using the non
thread safe PHP binaries with
Microsoft's new FastCGI handler is
like putting twin turbos on your car
(without the inherent risk of blowing
up your engine)

so can i say if i use iis, i should use non thread safe php and thread safe for apache?

Best Answer

i read somewhere

I read somewhere that the earth is flat - it must be true. Please cite your sources.

thread safe is for multithreading

This is non-sensical

and is faster

Possibly true depending on a large number of other factors.

shldnt php just release a thread safe php?

PHP has been thread safe for a very long time (approx 10 years now). You may be refering to the issue that Rasmus Lerdorf pointed out some time ago, that adoption of thread-safe code by third-party developers (i.e. extension writers) was expected to lag behind PHP's adoption. It is not known whether this is still the case.

This new FastCGI handler from Microsoft

You seem to be under the impression that this amazing new invention by Microsoft (no, just a new release of software originally designed by someone else) can somehow seperate the threadsafe and non-threadsafe parts of the php installation - this is not the case.

putting twin turbos on your car

I expect it feels like that compared to the alternatives on MSWindows.

so can i say if i use iis, i should use non thread safe php and thread safe for apache?

This sentence does not make any syntactic sense. Certainly for production systems, unless you have reason to believe that the system may be thread safe, then you should not use a threaded PHP module. And for Microsoft NT / Solaris / AIX systems then there is a performance beneift in using a threaded apache. For Linux systems the difference between threaded and pre-fork is significantly less. Not sure about BSD / Apple.

Related Topic