Slashdot Mirror


PHP Optimized for Windows Server 2008

Stony Stevenson writes "It used to be that popular PHP applications would run more poorly on Windows Server than on a Linux or Unix servers, for which PHP had been optimized. Specialist in the PHP language Zend Technologies now says that's no longer the case. The Zend Core commercially supported form of PHP has been certified by Microsoft as ready to run 'with performance and stability' on Windows Server 2008, said Andi Gutmans, co-founder and CTO of Zend. Previously, PHP 'didn't run as well as it should on Windows,' said Gutmans, despite the fact that 75% to 80% of PHP users were developing on Windows workstations."

38 of 182 comments (clear)

  1. In Short by TheRealMindChild · · Score: 4, Insightful

    So, in short, they aren't using cygwin anymore to compile it.

    --

    "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  2. FastCGI != Apache Module by Foofoobar · · Score: 4, Informative
    As a CGI you still have to make extra system calls that you don't have to make as an apache module. Running under FastCGI is a good first step but it still doesn't make it as fast as running it as an Apache Module. In a recent post on Slashdot about how Microsoft is learning from open source, they claim they made IIS more modular like Apache but this is not the case as PHP proves otherwise they could run it as a module.

    I applaud the effort to embrace open source languages though and hope they continue along this path of self improvement.

    --
    This is my sig. There are many like it but this one is mine.
    1. Re:FastCGI != Apache Module by theGreater · · Score: 2, Interesting

      Furthermore, FastCGI under IIS (haven't tried with anything newer than 2003r2/IIS6) isn't fully compatible with at least one popular application that I can think of.

      http://wordpress.org/support/topic/150672

      -theGreater's $0.02.

    2. Re:FastCGI != Apache Module by arodland · · Score: 4, Informative

      In my testing (Perl, not PHP, but I don't think it particularly matters here), a "real world app" ran 98% as fast under FastCGI as under mod_perl -- and FastCGI is easier to deploy, easier to maintain, and (in the simple case) better on memory. Is it really worth chasing that extra 2%?

      Of course, in the case of PHP, there's an extra incentive. I don't trust PHP's security or sanity for shit. So I'd much rather have it running in its own process with its own permissions than have it dynamically linked directly into my webserver :)

    3. Re:FastCGI != Apache Module by Firehed · · Score: 2, Insightful

      PHP's security isn't so much a problem compared to non-security-conscious developers working with it since it's so damn easy to pick up. If you're running stuff like $query="INSERT INTO `users` (`name`) VALUES '${_GET['name']}';";, it really doesn't matter what language you're using.

      --
      How are sites slashdotted when nobody reads TFAs?
    4. Re:FastCGI != Apache Module by mini+me · · Score: 2, Funny
      Very true. I once inherited a Ruby on Rails project that had code similar to this:

      @variable = eval("@#{params[:variable]}")
      I think I'd rather see SQL injection vulnerabilities.
    5. Re:FastCGI != Apache Module by TheRaven64 · · Score: 2, Informative

      If you're running stuff like $query="INSERT INTO `users` (`name`) VALUES '${_GET['name']}';";, it really doesn't matter what language you're using. But a language which uses this kind of thing, rather than a printf analogue with encoded type information is much more likely to encourage this kind of code. The PostgreSQL C interface contains a printf-like function which doesn't include the arguments in the SQL string at all, it puts pointers to arguments and the arguments themselves in the packet sent to the server so there is no escaping ever required because string arguments never go through the SQL parser. The same is true of most databases, and yet PHP still makes it easier to assemble queries as strings and throw them at the DB than use a sane interface.
      --
      I am TheRaven on Soylent News
    6. Re:FastCGI != Apache Module by pdxp · · Score: 3, Interesting

      PHP used to also ship as an ISAPI module, but it did pretty much the same thing that the CGI did- reload the interpreter for every single request. I'm not sure why they bothered with FastCGI when it would've required about the same amount of effort to write an ISAPI extension. It might have to do with the fact that PHP's source code was more spaghetti-like than any PHP code one could dream up, and not trivial to follow or modify.

      It would be interesting to compare the performance to that of Python [insert framework name here] on Windows, both the ISAPI version and the FastCGI version.

    7. Re:FastCGI != Apache Module by jsebrech · · Score: 2, Informative

      PHP's issues with ISAPI are due to it not being thread-safe. We've tried to deploy PHP as ISAPI on windows, and things run fine until the customer starts using an application module that uses GD, or some other non-thread-safe extension, and then you get sporadic crashes that come more often as the load increases (which is obviously the worst time for a server crash).

      FastCGI's benefit is that every FastCGI handler is still a separate process, so you don't run into threading issues, while at the same time not invoking the cost of constant process creation (which on windows is expensive), because the processes are reused.

  3. Light on details by Anonymous Coward · · Score: 2, Insightful

    It would have been nice to know the areas that they optimized to get the performance increases. Unfortunately the article is a little light on the details.

  4. Other incapatiblities by Freexe · · Score: 2, Insightful

    There are still many other compatibility issues between PHP on Windows and Linux that make it hard to push things from a Windows box straight to a Linux box without extra testing.

    --
    "In a time of universal deceit - telling the truth is a revolutionary act." - George Orwell
  5. Misleading by MojoRilla · · Score: 5, Insightful
    This is misleading.

    75% to 80% of PHP users were developing on Windows workstations.
    And how many of these applications are being deployed on Windows? Probably not that many. Windows isn't a great server operating system.
    1. Re:Misleading by dedazo · · Score: 2, Insightful

      Windows isn't a great server operating system.

      Not for PHP applications, no. Good enough for light testing, but not production.

      .NET-based applications on the other hand, work great. Server 2003 and 2008 now are great platforms for them. So when you say "isn't a great server", I expect you mean "for the language/technology I choose to work for", much as Mono-based apps are not exactly mainstream or very well tested in Apache.

      --
      Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
    2. Re:Misleading by Santana · · Score: 4, Informative

      This is misleading.

      Only if you have problems reading English. That sentence clearly speaks about development, not deployment.

      --
      The best way to predict the future is to invent it
    3. Re:Misleading by muszek · · Score: 4, Funny

      Food? Are car analogies not good enough for you?

    4. Re:Misleading by richlv · · Score: 2, Insightful

      actually, it is misleading. it does not have any reasonable connection with the fact itself/article.
      well, unless those developers run windows 2008 server on their workstations.

      --
      Rich
    5. Re:Misleading by kripkenstein · · Score: 2, Insightful

      This is misleading.

      Only if you have problems reading English. That sentence clearly speaks about development, not deployment.

      No, he was right on the mark. You are correct that the sentence clearly says development. But the point is that mentioning development in this context is misleading. It doesn't matter where code is written, it matters where the code is run, if you are talking about the performance of the code. TFA is misleading in that respect. It seems their point has an underlying assumption that development and production should be on the same OS or something like that; under that assumption the quote makes sense. It's a faulty assumption though.
    6. Re:Misleading by andigutmans · · Score: 2, Informative

      That is exactly the point. There are very few Windows deployments because PHP on Windows was 2-3 times slower than on Linux and unstable before we made the said improvements in PHP and Microsoft built FastCGI support into IIS 7.

    7. Re:Misleading by jsebrech · · Score: 4, Insightful

      And how many of these applications are being deployed on Windows?

      My company's PHP based software runs over 95 percent on IIS servers. We have a single customer that uses linux for their web server platform (a university). We're talking about big customers here, like Siemens and ISS (one of the world's largest cleaning firms), with dozens of servers each running our platform, all of them Windows servers.

      We've been deploying PHP on fastcgi the whole time. ISAPI has never been stable, and CGI has always been too slow.

      Tthe situation changes for non-intranet web apps. Those tend to be linux-hosted because people tend to outsource their hosting. But for in-house hosted software, most of the time you have to fall back on the existing network team, who is usually specialized in windows, so they tend to prefer windows-based web servers, even if it's just for the sake of uniformity.

    8. Re:Misleading by discogravy · · Score: 2, Funny

      lots of people eat in their cars, but who prepares food in their cars?

      I suppose you could make a very complex analogy about tailgate parties or something, but it really seems like too much trouble.

  6. Nothing to do with optimization by dedazo · · Score: 5, Interesting

    PHP on IIS5/6 had to run as a CGI application, because their ISAPI handler implementation was historically crappy and unstable under load. CGI under the thread-oriented (as opposed to process-oriented in *nix) pipelining model of Windows was usually not a good performer. IIS7 introduced FastCGI, which is what Zend used to "certify" PHP to run on Server 2008. But FastCGI is not an optimization, it's a new execution mode for IIS. Nor was PHP modified (AFAIK) in any way to run effectively on FastCGI. Python apps also run very well on it (which personally is more exciting to me than PHP).

    --
    Web2.0: I love when people Flickr my cuil and digg my boingboing until my google is reddit and I start to yahoo
  7. Re:Optimise your spell check by oxidiser · · Score: 5, Informative

    It's a British spelling. Like my handle (Oxidiser) or Aluminium.

  8. Marketing by LingNoi · · Score: 2, Interesting

    Meh, I wouldn't believe Zend. They're in corporation with Microsoft to provide better interoperability... They're not going to go into a deal with Microsoft and then say, "Still sucks on Windows server" are they?

    Surely it should also run better on all windows servers so why just 2008? Unless they're trying to find reasons for you to upgrade..

    1. Re:Marketing by Constantine+XVI · · Score: 3, Insightful

      Sounds like IIS 7 (in '08) has something called FastCGI which they used to get the better performance.

      --
      "I think an etch-a-sketch with an ethernet port would beat IE7 in web standards compliance."
  9. Comment removed by account_deleted · · Score: 4, Insightful

    Comment removed based on user account deletion

  10. PHP on Windows by corychristison · · Score: 4, Insightful

    ... like Ruby on Rails?

    Just kidding. Seriously, though, it said "commercially supported form of PHP". Be sure to take a big mental note of that.
    Commercial == fee's. Based on Zends track record of charging for things, it's not going to be cheap for single developers... I have a feeling it'll be in the area of $800-$1500 per CPU or something silly like that... in which case, why not just use a UNIX/derivative?

  11. Why not Apache? by edmicman · · Score: 5, Insightful

    We run a .NET shop here, but even I wonder, why not just install Apache on Windows? Errrrr, or why not just go the easy route and put up an Ubuntu LAMP server? Everything I work on is in Windows, but I just don't see the benefit of running PHP on Windows...what does [Microsoft say] the Windows platform offers for PHP that running it on freely available platforms doesn't?

    1. Re:Why not Apache? by RipSUp · · Score: 5, Funny

      They don't want your LAMP to become a WAMP, they want it to become a WIMP (Windows/IIS/MSSQL/PHP)

    2. Re:Why not Apache? by jjrockman · · Score: 4, Funny

      Don't you mean Windows IIS MySQL PHP/Perl? Or, WIMP for short.

      --
      Quit jabbering on the phone while driving. You are not that important.
    3. Re:Why not Apache? by jfbilodeau · · Score: 3, Interesting

      Agreed.

      In 2004-05, I wrote a PHP application for a client. We had agreed ahead of time that the app would be written in PHP. Upon delivery, everything worked great on the test (WIMP) server that I set up myself. When the technician was called in to put the application in production, he said no problem. I should point out that the fellow is a hard-core and experienced MCSE.

      A month later, the application was not installed. I called the technician to find out what was happening, and I was given the story of being too busy. I offered to do it myself, but they would not agree to that. The tech promised to install it ASAP.

      A week later, still nothing. Called again. After I pressed the technician as to why he would not install it, the answer he gave we what that 'installing foreign application like Apache & PHP may destabilize the server ecosystem.' According to him, it should have been written in ASP(.Net).

      What a wonderful Microsoft-ish answer. He finally agreed to install PHP after I pointed out that PHP CAN run on IIS.

      The FUD and BS that MS crams down their MCP just makes my blood boil. Disclaimer: I _was_ a MCP and MCT, so I know the type of stuff Microsoft feeds.

      The appplication works. It still being used today by dozens of offices across Canada (coast-to-coast). And as far as I know, the maintenance has been near 0.

      Most of my applications are LAMP, and the maintenance time/cost has been near 0.

      --
      Goodbye Slashdot. You've changed.
    4. Re:Why not Apache? by Phroggy · · Score: 2, Informative

      Don't you mean Windows IIS MySQL PHP/Perl? Or, WIMP for short. Not quite - MSSQL, not MySQL!
      --
      $x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
      $x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
  12. Re:It ain't no workstation... by jfbilodeau · · Score: 2, Interesting

    You mean there's a difference between Windows as a workstation and Windows as a server beyond price? Oh, and the crippling of a couple of services?

    Maybe I should become one of the 75% to 80% of PHP developers who use this 'Windows' thing and see the difference myself.

    --
    Goodbye Slashdot. You've changed.
  13. If you have to contact sales to find out the price by symbolset · · Score: 4, Informative

    Then the answer is: "More than it's worth."

    --
    Help stamp out iliturcy.
  14. Re:Optimise your spell check by FyRE666 · · Score: 4, Funny

    President Bush? Is that you?

  15. Windows tco winner! by sjwest · · Score: 2

    Php guru: you need a windows zend license.
    Boss: So if we pay somebody else it will work better in windows
    Php guru: yes
    Boss: Windows has great tco doesnt it.

  16. Optimized double misery by 200_success · · Score: 3, Funny

    PHP and Windows? They each suck enough on their own.

  17. Re:Optimised? by Cal+Paterson · · Score: 2, Informative

    I didn't mean to say American English has no rules. Only that English English has more, and that they are less logical and harder to remember. You're picking a grammar fight when I don't have Fowler's to hand, but from memory;

    Singular with an s-ending takes word+'s
    Plural without an s-ending takes word+'s
    Plural with an s-ending takes word+es'
    The United Nations (and other singular entities with plural names) takes word+'s

    Between this and contraction forms, it's pretty obvious why apostrophes are dying out.

  18. Re:another prese by PHPfanboy · · Score: 3, Informative

    Zend is the PHP Company. I don't think it's any great secret that their aim is to monetize PHP. I'm not sure there's anything inherently wrong with that. Plenty of other companies and individuals monetize PHP by providing software, consulting, hosting and other services around PHP If there's value-add provided, companies will pay.

    You're probably perfectly aware that there are a large section of Linux using shops who are perfectly happy to pay, hence the success of RHEL and to a lesser extent SuSE and now Ubuntu all of which offer support around free stuff.

    The fact that Zend has worked with IBM on PHP for i5 (AS400) and with Microsoft for decent PHP on Windows only increases the choice of platforms PHP developers have to deploy on, makes PHP projects more popular across other user bases and means that PHP developers have a wider range of employment opportunities available to them. I don't think anyone is under the illusion that the future of PHP development is at 6 person consultancies who specialize in tweaking free CMSs, surviving on that free good stuff and creating pure karma (with no disrespect to small web consultancies intended, but it's a limited niche to attract new active members to the community).

    If you'd like to spend your time pitching PHP as a strategic application development option to Fortune 500 companies, government departments and other enterprises, I'm sure we'd all be delighted, but there's not much chance of you spending your time doing that, nor quite frankly of those entities listening to you. They do however talk to Zend.

    Zend isn't imposing a cost/tax on anybody or demanding that people pay homage/tribute, especially as PHP is a community project and not owned by Zend. During the past 2 years Zend has increased the amount of free and open source work they've done (Zend Framework and the Eclipse-based PDT) so it's not like they take and don't give.

    If there is value companies can get from Zend's solution set, then they will pay for it. And they do. It's simple cost-benefit equations. WRT your "siphoning off revenue" if you look at all the companies in the Open Source space (including MySQL, EZ Publish, Acquia and other) they all provide value adds.

    And yeah, I work for Zend. And no, you don't have to buy our stuff (but at least come check it out). And no the decision to monetize PHP wasn't made by executives on the fringe of the FOSS world, but rather technology people in the middle of it. (I have no idea whether they have hair up their asses like you claim - but can gladly inform you that that's not a sound basis for a business strategy unless you're a barber looking for a niche....)

    --
    29 mpg. YMMV.