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

38 of 465 comments (clear)

  1. PHP used to be an ASF project by gtrubetskoy · · Score: 5, Interesting

    I should probably be noted that PHP used to be an official Apache Software Foundation project until it was mutually agreed to end this relationship. I have no clue as to what the underlying reasons were and as an ASF member myself would rather not speculate on this. See ASF Board Meeting Minutes for Feb 2004 (section 5.G).

    P.S. Apache 2.0 is great and there is no reason not to use it IMO.

    1. Re:PHP used to be an ASF project by snipersock · · Score: 2, Interesting

      Last Sunday, if I saw the cpan.org recent news corrently, rc2 was out. Its looking to be released sooner than your probly think. And aside from your problems, I'm running loadbalanced apach2 with mod_perl2 and Mason without any issues at work.

    2. Re:PHP used to be an ASF project by slive · · Score: 2, Interesting

      PHP used to be called an ASF project. But that was back when being an ASF project didn't really have any formal meaning. When the ASF started to put more structure on its oversight process in order to assure that it could protect its code and committers, it was decided that the PHP project didn't want ASF oversight, and there was an amicable separation.

    3. Re:PHP used to be an ASF project by osu-neko · · Score: 2, Interesting

      I've had the same sort of virtual host problems with PHP, except under Apache 1.3.

      --
      "Convictions are more dangerous enemies of truth than lies."
    4. Re:PHP used to be an ASF project by Bert64 · · Score: 3, Interesting

      This would be a huge headache for people who provide webhosting tho..
      For instance, i am unable to upgrade my server to php5 because many customer code won't run correctly on it.. But before too long, we will have customers demanding php5 because their code doesn't work on 4..

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  2. It's a threading issue by Bruce+Perens · · Score: 5, Interesting
    Either PHP itself, or many PHP applications, are not written to deal with the multi-threading offered by Apache 2.0 . So, it seems, you will do best if you install one of the less optimal threading models. And then you lose much of the benefit of Apache 2.

    Apache 2 and a recent Linux kernel come pretty close to the theoretical limits of the hardware when it comes to serving static content. It just loafs along while saturating whatever net connection you give it. It's worth trying out.

    Bruce

    1. Re:It's a threading issue by EnronHaliburton2004 · · Score: 2, Interesting

      And then you lose much of the benefit of Apache 2.

      I don't understand.

      Are the PHP developers not recommending Apache 2 because it is harmful to upgrade? Or are they not recommending Apache 2 simply because there really aren't any benefits to upgrading.

      Upgrading (and rolling back an upgrade) Apache has always been pretty simple, and it's pretty easy to have a 1.3 Apache running alongside an Apache 2.0.

    2. Re:It's a threading issue by rho · · Score: 2, Interesting
      Apache 2 and a recent Linux kernel come pretty close to the theoretical limits of the hardware when it comes to serving static content. It just loafs along while saturating whatever net connection you give it.

      As I recall, an old benchmark showed that a 486 running Linux and Apache could saturate a T1 serving static content. I'm not sure what benefit a "static content" metric has to any discussion concerning modern Web technologies. If static content is your problem, there are gobs of Web server solutions, such as that old kernel HTTP server, whatever it was called. Threading, pre-fork, blah blah blah--it's all gobbledy-gook when you're talking serving plain-jane HTML files.

      I think Apache solved the problem too well with the 1.3 branch. It's a robust, fairly clean solution to serving Web content, either static pages or some degree of dynamically-created Web application. If you need to do either, or somewhere in between, Apache 1.3 is a decent solution. The way I see it, if Apache wanted to differentiate their 2.0 branch, they could have gone either one or both of these routes: 1) build it with the intention of catering to the Web application market; or 2) build it with the intention of catering to the Web hosting business.

      With 1), the core problem of dynamic Web sites is the glue between a database and the HTTP server. Quite a lot of Web sites would be equally well-served by a lightweight HTTP server on top of a relational database. Something like Oracle's IAS, but... not. If Apache 2 could offer something like that, then they would have something to offer Web application developers. (And, incidentally, create a new market the way Tomcat/Java servlets did and thus a stable base of users.)

      With 2), there's a lot of work done by companies such as PSoft and Ensim to provide a facility for hosting several Web sites from a single IP address, and allowing those Web sites to have some control over their site. If Apache 2 could offer some method for improving this situation--"how" I leave as an exercise for the reader--then they would have something to offer hosting companies. (And, incidentally, create a whole raft of adopters as most people who buy Web space at a hosting company for $29.95/mo, or whatever, don't give a fig for what HTTP server is running behind their site.)

      As-is, Apache 1.3 can do both 1) and 2) good enough, and as we all know, good enough is good enough. Everybody will eventually move to 2.0, if only because RedHat stops supporting 1.3 in their up2date utility. I don't think there will be a mass exodus to Apache 2.0 for any technical reason, like the movement we see today towards FireFox from IE, because Apache 1.3 isn't a complete piece of shit. It's pretty good, as a matter of fact, and that Apache 2.0 isn't exactly bursting with new, revolutionary ideas that can change the world, the change will come slowly and quietly, until one day you'll sit up in bed and wonder, "Whatever happened to Apache 1.3?"

      --
      Potato chips are a by-yourself food.
  3. No need to switch ... by Anonymous Coward · · Score: 5, Interesting

    I run a FreeBSD server with Apache 1.3.33 and PHP 4.3.10. When I was upgrading it a week or two ago to FreeBSD 5.3, I thought about making the switch to Apache 2.0. But then I thought ... What is that going to bring me?

    Apache 1.3 has been working flawlessly for me. Until I have a compelling need to switch to Apache 2.0, I'm not going to. I understand that there are some nifty new features in Apache 2.0, but not a single one of them is something that I want/need.

    This, I think, is the primary reason why people aren't going to Apache 2.0 in droves, not the PHP team's "FUD".

    1. Re:No need to switch ... by rbowen · · Score: 2, Interesting

      Right ... and, like I said (I thought, pretty clearly) I'm not saying that everyone should switch. I'm merely asking for the PHP website to stop discouraging migration for those folks who do have reasons for doing so.

      I know, suggesting that Slashdot might be misinterpreting my words is close to heresy ... ;-)

      --
      Apache guy, Open Source enthusiast, runner
  4. A solution looking for a problem. by Anonymous Coward · · Score: 1, Interesting
    Seems to me Apache 2 is a solution looking for a problem. Yes, they can create some strawman arguments about some hypothetical thing 2 may do better than 1.X. But for all real-world problems I've encountered, Apache 1.X suits me just fine.

    If Apache wanted people to move to 2, they should provide benefits that make people want to go through the effort to move.

  5. Nobody told me! by Anne+Thwacks · · Score: 2, Interesting
    I never knew there was a problem - I have three mission critical servers (telecomms billing) running PHP5 on Apache 2, and nothing seems to have gone wrong in 12 months of 24/7 operation.

    What is supposed to be the problem?

    --
    Sent from my ASR33 using ASCII
  6. Re:FUD in it's purest form ... by Raxxon · · Score: 3, Interesting

    This was the major reason that PHP has been said not to be used with Apache2. It has NOTHING to do with Apache, it's potential security issues with PHP and some non-thread-safe **EXTERNAL** libs. 95% of it is security related issues. If you're willing to pay attention to your server (like all good admins are supposed to do) there's no real problems that I've seen.

  7. Using PHP on Apache 2.0 right now. by suso · · Score: 4, Interesting

    I'm using PHP on Apache 2.0 production servers right now. Honestly, I can say that PHP is more at fault for its own problems. I think that having lots of configurable options for a programming language is a bad idea. It leads to applications working on one installation of PHP, but not another. Administrators who enable things like safe_mode and turn off register_globals on shared servers are made fun of by ignorant programmers who don't understand what safe_mode is for and its usefulness. I have encountered all of this.

    The one thing that I wish PHP would take advantage of in Apache 2.0 is the ability to run code as a user other than the web server. Every time I bring this up with the PHP developers, nobody really runs with it. A feature like this would make PHP much better in shared systems and prevent people from having to do weird things to ensure security. I guess PHP is not that great for shared systems right now.

    1. Re:Using PHP on Apache 2.0 right now. by drew · · Score: 2, Interesting

      I think that having lots of configurable options for a programming language is a bad idea. It leads to applications working on one installation of PHP, but not another.

      i agree completely- i have had no end of problems with one of my co workers who continually writes code that requires register_globals and magic_quotes_gpc, no matter how many times i ask him not too. and even though i have told him that those options will be turned off for any new system that i set up, he still asks me why his code is breaking every time i set up a new site...

      what's really annoying is that this guy is the most paranoid guy i've ever met when it comes to securing servers against remote shell exploits. apparently he couldn't care less whether he is writing exploitable web sites, though...

      --
      If I don't put anything here, will anyone recognize me anymore?
    2. Re:Using PHP on Apache 2.0 right now. by Rich0 · · Score: 2, Interesting

      There simply shouldn't be a php.ini. Or if there is one it should be along the lines of the config files other languages use to set up DNS resolution, library load paths, etc.

      Imagine if every system had a gcc.ini, a glibc.ini, and so on?

      Imagine if allow_pointers, disable_switch_statement, and short_circuit_boolean were system-wide global settings?

      Good luck getting enough compatible software on a system to even boot it!

      A language should have defined default behavior. If you want to modify the default behavior, this should be done via a directive in the source code of some sort. Then each program can have its own settings. If you have a webserver with 100 programs on it, and one requires register_globals, why enable this for every piece of source on the server?

  8. What extensions? by bucky0 · · Score: 3, Interesting

    Is there a list somewhere of extensions that are known to be non-thread safe? Or do I need to just test them one by one?

    --

    -Bucky
  9. Re:Why are there two?? by Anonymous Coward · · Score: 1, Interesting

    Commercial software vendors typically deploy products in this manner. They fork the code base, or rewrite it entirely but continue to maintain and support the old base for many years.

    The apache foundation is one of the FEW open source projects that actually do this. Its probably one of the reasons why the apache webserver is so ubiquitous.

    On the other end of the spectrum, you have jboss. Uggg. Go from 3.2.3 to 3.2.5 to 3.2.6 and all are MAJOR upgrades in terms of effort to migrate your code base to the new versions. Its horrible. I would have loved it if 3.2.3 had been supported with regular patches, upgrades etc... but was forced to move to the higher "point" releases. bleh.

  10. apachetoolbox supports the 1.x apache by phildog · · Score: 2, Interesting
    For me the reason to use apache 1.x with PHP is very simple. That is the only configuration that is supported by ApacheToolbox.

    I've done the roll-your-own apache/mod_perl/mod_php/mod_etc.etc.etc... thing before. I'd love to have those hours of my life back. So if the Apache foundation really cares about evangelizing 2.x why don't they create something as powerful as ApacheToolbox that actually works with 2.x?

    --
    slashsearch.org - slashdot search. powered by google.
  11. Re:Homegrown apps are one thing... by Bruce+Perens · · Score: 3, Interesting
    I suspect, and here I'm out on a limb, that it's a fundamental architecture issue. PHP simply did not have global thread-safety as a design goal. And thus it could be difficult to remedy at this late date, especially if it's to be done without breaking things.

    Bruce

  12. I think they're right by jeif1k · · Score: 3, Interesting

    PHP prides itself on being an easy-to-use language for web applications, and it succeeds. Unfortunately, Apache hasn't become any easier to install and configure between 1.x and 2.x; in fact, if anything, I think it has gotten overall worse. That's why Apache 1.x is a better match to PHP than Apache 2.x. If Apache wants 2.x to be a better match with PHP, then Apache needs to address the problems the PHP community sees with 2.x.

    Personally, I'd like to see more server alternatives to Apache anyway. I think there should be a handful of FOSS web servers capable of hosting PHP, web servers that make different kinds of tradeoffs between performance, security, and ease-of-use. The huge market share that Apache has, from my point of view, is a problem, just like the huge market share that Microsoft has in other areas.

  13. Don't see the issue with Apache 2 and PHP by web_boyo_in_sac · · Score: 2, Interesting

    I've been using Apache 2 and PHP for almost a year on a pretty high traffic system and it works fine. But I don't do any image work or odd compression or scientific formulas so I don't compile some libs in. I think the Zend guys need to actually break down which libs shouldn't be run with Apache2

  14. Apache Tweak. by DarkHelmet · · Score: 5, Interesting
    I've been running Apache 2.0 for the past year or so, without any problems whatsoever.

    The problem is running apache in WORKER or PERCHILD MPM modes. Those are the ones that are using threading.

    What I'd recommend to anyone who wants to have a robust, fast apache implementation is to do the following:

    • Setup a version of Apache on port 80 that runs worker MPM. Use this version for serving images and html files.
    • Setup a separate version of apache (port 9000 or whatever) on prefork that runs all CGI / PHP based stuff.
    • Proxy requests matching PHP / CGI / etc to the port 9000 version of apache.

    There you go... performance increase for 75% of serving requests.

    P.S: Avoid perchild at all costs!

    --
    /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
  15. Much the same as... by yoshi_mon · · Score: 2, Interesting

    In large projects there are often people who have production systems that would incur large costs if they were forced to do a major rev upgrade.

    Of course before OSS this was never an issue as people didn't have a choice but as people now do, thanks largely in part to the ability of OSS project heads to put a few "free" developers on a older rev for maintenance, large OSS projects often maintain older revs for the sake of the users..

    You really need look no further than the Linux Kernel to see another example of this in action.

    --

    Really, I know what I'm doing...Ohhhh, look at the shiny buttons!
  16. Re:FUD in it's purest form ... by Bruce+Perens · · Score: 2, Interesting
    So, why don't they put a lock around the PHP interface to those libraries? Or why don't they make thread-safe successors of those Free libraries that, presumably, they do have the power to edit?

    Bruce

  17. Re:Apache2: The only choice for Win32 by JimDabell · · Score: 3, Interesting

    I'd gladly ask the Apache and PHP guys to fix their "nobody" user problem, and start PHP with separate accounts.

    Apache 2 threaded MPMs can run different vhosts under different users, so this has been fixed for over two years. If PHP was thread-safe, you wouldn't have a problem, but as this story highlights, PHP doesn't play nice with threads.

  18. Re:FUD in it's purest form ... by Matt+Perry · · Score: 4, Interesting

    Because v2 is more powerful. Filter chains for one. You can have the output routed through various modules and even shell commands before it's served up to the user. For example, if you want the output of a CGI to then go through server side includes expansion, then gzipped and served to the user. Apache 1.x doesn't have that kind of flexability.

    --
    Slashdot: Failed Car Analogies. Amateur Lawyering. Anecdote Battles.
  19. Re:FUD in it's purest form ... by JabberWokky · · Score: 4, Interesting
    Several of the libraries are commercial software interfaces. I have no idea how many (if any) are unsafe, but they are things like interfaces to Oracle, commercial layout software, etc.

    As for putting a lock around them, I'd imagine that when that happens, it would be considered thread safe *except*...

    PHP has a user contributed library system similar to CPAN called PEAR. Some of the libraries in PEAR aren't threadsafe... and even if somebody went through and updated them, next week there will be several new one that are not threadsafe.

    Now, all of this would be moot if there were a compelling reason to push to Apache2. The impetus would be there to do the work. But, right now, the last of the 1.x series is just as stable and performs as well as Apache2. That means that there's simply no reason to do the work, and Open Source doesn't like to do unnecessary work.

    When there is a benefit to the ongoing work necessary to make it and *keep* it threadsafe, it will likely be done.

    --
    Evan "And yes, I realize the irony of saying how Open Source works in this reply"

    --
    "$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
  20. Re:Why are there two?? by Anonymous Coward · · Score: 1, Interesting

    I have been interpreting the continued maintenance of the 1.x line for years as a statement that 2.0 was not ready for prime time.

    Heck, it doesn't help that they have an "alpha" 2.1 line, that makes the 2.0 line feel even more like its in beta testing.

  21. Re:apache2 is essential for Windows by Evil+Grinn · · Score: 3, Interesting

    However, the issue is that many PHP extensions are not threadsafe. This becomes an issue on Windows because the default MPM is multithreaded, while the default MPM for UNIX is multiprocess.

    It all goes back to Windows NT being designed from the beginning to enourage the use of threads, while Unix always favored multiple processes.

  22. Re:FUD is logical. by Qzukk · · Score: 2, Interesting

    no one has dared to make a COMPLETE TEST of PHP running with Apache2, explaining which PHP modules fail and why.

    This is what I want to know. Which modules use libraries that are threadsafe (or have threadsafe versions)? Which modules are known to crash the thread?

    I build php here with postgresql as the only additional library over whatever the default modules are (and I have found threadsafe patches for libpq). Is having threadsafe libraries enough?

    --
    If I have been able to see further than others, it is because I bought a pair of binoculars.
  23. Re:Homegrown apps are one thing... by Evil+Grinn · · Score: 2, Interesting

    suspect, and here I'm out on a limb, that it's a fundamental architecture issue. PHP simply did not have global thread-safety as a design goal. And thus it could be difficult to remedy at this late date, especially if it's to be done without breaking things.

    Which, as I have remarked earlier, is a sympton of PHP never having been designed to run on Windows.

    Maybe there's an opportunity for someone to get famous by writing PHP interpreters in both Java and C#, and then they can sell it to all the PHB's out there who can't decide whether to go with J2EE or .NET. That should take care of the threading issues, although it would almost certainly break existing extensions written in C/C++. I am only half kidding.

  24. mod_lisp by stesch · · Score: 2, Interesting

    Well, mod_lisp was a good reason to stay with Apache1. But there was some work done on the Apache2 version of the module, so it should be all clear to upgrade to Apache2, if you need it for more than just serving to your lisp image.

  25. The bloat is BEFORE sendfile() by wtarreau · · Score: 2, Interesting

    For most web servers on Linux, once the server has figured out what static file to send, it calls sendfile() and the rest of the work is entirely in the kernel

    The problem with apache performance lies in everything that it executes *before* sendfile() is called. Sure you'll be able to serve *ONE* static file at wire speed, but when it comes to serve *many* files per second, the initial overhead puts the foot on your way.

    And unfortunately, apache is not good either for serving large files because of the important memory (and scheduling) cost of each concurrent thread (or process in case of preforked). Apache is good as an application server, not as a static content server.

    willy

  26. PHP suExec is available. by kbahey · · Score: 2, Interesting

    The one thing that I wish PHP would take advantage of in Apache 2.0 is the ability to run code as a user other than the web server. Every time I bring this up with the PHP developers, nobody really runs with it. A feature like this would make PHP much better in shared systems and prevent people from having to do weird things to ensure security. I guess PHP is not that great for shared systems right now.

    suExec for PHP is available. My ISP has switched to PHP suExec several weeks ago. I noticed that something was different when cookies was not set properly, and the PHPSESSID was set in the URL (ugly, so I noticed).

    This facility makes PHP runs as the user him/herself, instead of the Apache user (just like you wanted). This is a more secure environment for sure.

    You need to have a php.ini file with the parameters you want, in your public_html directory, to override the defaults (e.g. how the PHPSESSID is handled, by a cookie, or in the URL, how long a session is valid for, ...etc.)

  27. PHP-as-CGI doesn't work on many web servers by Luke+Mewburn · · Score: 2, Interesting
    Except PHP-as-CGI relies upon a "non standard" CGI variable (SCRIPT_FILENAME) to operate correctly, and many non Apache/IIS web servers don't provide that variable. Thus, PHP doesn't work under them.

    I worked out this problem a while ago, submitted bug 28227 with fix, and it's been sitting in the PHP bug database doing nothing for months. Not only that, but many similar bugs (without fixes) were closed prematurely by the PHP team under the incorrect assumption that the submitter's system was misconnfigured, as opposed to PHP being buggy...

  28. Apache2.0 = XFree86 by mnmn · · Score: 2, Interesting

    Fights between opensource projects are always sad. Part of the openness is use it however you like... recommendations are opinions. ASF isnt quite blocking PHP yet, but things can go wrong as we've seen in the case of jboss and xfree86.

    Whats stopping anyone from uniting php and apache1.3 and packaging them together for each platform the way sqlite was incorporated into php? They go well together, makes alotta sense to be the same project.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
  29. Re:Stop picking on PHP by cant_get_a_good_nick · · Score: 2, Interesting

    My belief is that PHP is fine under threads, a lot of the third party stuff is unknown (can be read: probably will break) and the PHP guys don't want to bother with broken 3rd party stuff.

    This kind of misses the point. The assumption "why bother with apache 2.0 if it doesn't run in multi-threaded mode" misses all the cool things that have gone into apache 2.0 outside of the threading models. I'ts a lot saner, and has cool things like chaining (output of CGI can go through SSI) and a million other things. The PHP guys should just say "run it in the old MPM mpde and have fun" which is I think the real sticking point.