Is Apache 2.0 Worth the Switch for PHP?
An anonymous reader writes "It seems like some of the members of the Apache Software Foundation are a little angry with the PHP Community because they don't recommend using Apache 2.0 with PHP. Since PHP is installed on half of all Apache servers this is a major issue for them. A number of high-profile PHP community members such as John Coggeshall and Chris Shiflett have blogged about this decision in light of a recent posting by Apache Software Foundation Member Rich Bowen which called PHP's anti-Apache2 stance FUD. Is there any real reason for the PHP community to start recommending Apache 2.0, especially when the 1.3.x series of Apache is rock solid and proven? Note Rich did later commend PHP for being a great product, so it's not all flames."
The problem that PHP can be linked against non-threadsafe libraries, and this causes issues with Apache 2 when it's using the Worker MPM. However, if PHP died and takes the thread with it Apache simple restarts it. I had Apache2 and PHP in this configuration for almost a year, and expect for threads randomly restarting because of PHP, I had no issues. If you want to solve the thread problem, change the MPM to prefork (which is the default last I looked), which emulates the Apache1 behavior, and stops that problem.
This signature was left intentionally blank.
All due repect (and I have a lot of it), but:
Either PHP itself, or many PHP applications, are not written to deal with the multi-threading offered by Apache 2.0.
That's just plain not true. The underlying threading problem has little to do with PHP, and absolutely nothing to do with PHP applications, but libraries to which PHP links (libmysqlclient, libpdf, libmcrypt, etc etc etc). It's these third-party libraries (over which the PHP developers have no control) that cause Apache2 to be unstable in the various threading modes (prefork works fine, but is just not officially supported).
S
This isn't to say that Apache is worthless. On the contrary, it is an exceptionally good server. It just doesn't scale as well as some others for static content.
-----
Free P2P Backup, Windows & Linux
It's on the download page:
"Apache 2.0.52 is the best available version"
"Apache 1.3.33 is also available"
The message would appear to be '2.0.52 is the best, but if you insist you can get a lesser version'.
It's very simple. We want people to move to 2.0, but since people have not done so, we're not going to leave them high and dry.
Apache guy, Open Source enthusiast, runner
I sustain 5 million hits per day on an Apache2+PHP server that (for me) indicates it's a "do-able" platform to run with.
Slashdot? Oh, I just read it for the articles.
Bruce
Bruce Perens.
Most of the benchmarks I've seen for Apache 2.0 on linux have been pretty ambivalent; the prefork MPM is generally better at ramping up to handle large numbers of connections, and serves more reqs/sec under high load, while the worker MPM serves large numbers of requests to small numbers of connections more efficiently. But those numbers seem to fluctuate based on the application and the number of processors used, and I've seen some applications where one model was nearly twice as efficient as the other--and I've seen that big a difference work in favor of both models, for different apps (which probably points to some MPM-specific design decisions in that particular application).
As always, the decision over whether to use threads or processes should be based primarily over whether you want to give up protected memory within your application or not (unless you're dealing with a platform like Windows where the process model simply isn't flexible enough to avoid throwing memory protection out the window).
rage, rage against the dying of the light
To their defense, the PHP folks say the problem is with libraries they don't control. But there could be a thread-safe PHP interface to them.
And I guess the bottom line is that they don't want to keep answering questions about this, so they just say don't upgrade to Apache 2.
Me, I use Zope. I think it's always been multithreaded.
Bruce
Bruce Perens.
Bruce
Bruce Perens.
Bruce
Bruce Perens.
IIRC, it was a license issue. The AFS wanted the PHP project to switch to using one of the ASF licenses while the PHP folks did not. PHP is still listed as a sister project. It's just not under the official ASF umbrella.
Slashdot: Failed Car Analogies. Amateur Lawyering. Anecdote Battles.
No, the PHP folks specifically tell you not to run PHP with Apache 2.0. It is in their FAQ on their website.
What seems to be lost in the noise is that PHP guys are not saying there is anything wrong with apache2. They are acknowledging that not all the extentions in PHP are thread safe.
In other words it's PHP at fault and not apache2 and they are admitting it.
evil is as evil does
You raise an excellent point. If the data you are serving up is highly sensitive then you are better served by the forking model which has a process wall between the data in your HTTP connections. You never know what kind of bugs a module will exhibit in a multithreaded scenario.
Absolutely. But it's not merely protecting sensitive data--OS architects worked hard for years to implement protected memory, and threads circumvent a lot of those gains (a bug in one thread can affect them all, all memory access needs to be synchronized, etc).
There are good times to use them, but the choice should be based on whether you need to share all (or most) of the memory as opposed to sharing little or none (when processes, possibly with shared memory segments, are the correct choice).
Too many people think that somehow "threads are faster" when (excepting egregious disparities a la Windows) that isn't necessarily true--and even when it is, the performance benefits are often tiny compared to the costs you pay.
rage, rage against the dying of the light
from the docs:
Do not use Apache 2.0.x and PHP in a production environment neither on Unix nor on Windows.