Slashdot Mirror


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."

6 of 465 comments (clear)

  1. FUD in it's purest form ... by Sonic+McTails · · Score: 5, Informative

    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.
  2. Re:It's a threading issue by TheTomcat · · Score: 5, Informative

    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

  3. Re:Why are there two?? by Anonymous Coward · · Score: 5, Informative
    I checked the front page of Apache and there were release announcements for the latest version of both lines. Neither announcement carried a statement indicating when you should use it over the other.

    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'.

  4. Re:Why are there two?? by rbowen · · Score: 5, Informative

    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
  5. Re:It's a threading issue by Bruce+Perens · · Score: 5, Informative
    No problem with the respect, this is an area in which I don't have tremendous expertise. But I submit that if PHP itself is in charge of its interface to a non-thread-safe library, it can put a lock around calls into it - effectively single-threading each library and that would perform at least as well as going to a less efficient threading model for apache, and potentially better depending upon where contention happens. And given that this is Free Software, thread-safe successors of those libraries can be developed.

    Bruce

  6. Re:It's a threading issue by Bruce+Perens · · Score: 5, Informative
    It's because there are potentially random problems because of two threads writing the same data at the same time. Code that depends on the value of a global variable not changing from one line to the next might break. Imagine that you increment a variable and then assume that its value is one greater than before, but it's really two greater.

    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