WordPress and PHP 5

Nick Lewis, Larry Garfield, and Dries Buytaert are discussing the slow rate of PHP 5 adoption and how projects such as Drupal and WordPress should help encourage PHP 5 uptake by phasing out support for PHP 4. WordPress currently supports PHP 4.2 or greater. We don’t even use functionality that was introduced in PHP 4.3. Whenever we accidentally use a PHP function present only in 4.3 or greater during our development cycles, we get a fair number of complaints from testers who don’t have 4.3. PHP 4 is thoroughly entrenched. If we were to change WordPress to require PHP 5 right now, we would abandon the majority of our users. Given the current state of affairs, requiring PHP 5 in the near future would seriously marginalize WordPress.

PHP 4 is so entrenched because it does the job. The bugs afflicting PHP 5 haven’t helped convince hosts to move over either. Almost every time a host does a PHP 5.x.x update, WordPress and other apps are broken in some way. Convincing hosts to upgrade to PHP 5 when doing so results in a lot of unhappy users is a hard sell. Sticking with PHP 4 means less support headaches for them.

That said, I agree that we do need to get people moving to PHP 5. Convincing developers to move is easy. I sure would like to have some of the PHP 5 features to make my life easier. A lot of WordPress developers are chomping at the bit to use the goodies in PHP 5. Developer convenience is secondary to the convenience of users, however. Chasing the latest tools and stranding users in the process is not cool.

So, how do we bring PHP 4 to the end of its days without showing our users the door? I don’t think application developers should be spearheading an end-of-life on PHP 4.  PHP needs to bite that bullet by setting an EOL date for PHP 4. An EOL on PHP 4 will be the biggest motivator for hosts to move to PHP 5. A lack of PHP 4 security fixes surely would make for some movement. Application developers would help by ensuring their stuff runs on the latest PHP 5 releases. Barring the occasional bugs, that is already the case with most well-known PHP apps. With a PHP 4 EOL in place, applications can EOL their PHP 4 support sometime thereafter. We at WordPress are in a similar situation with MySQL. We just recently bumped up our MySQL requirements. Part of what made that possible is the EOL announcements on older MySQL versions. If PHP is the chicken and applications are the eggs, I say the chicken gets to go first.

38 thoughts on “WordPress and PHP 5

  1. I’m not opposed to PHP 4 by any means, but some of the feature set introduced by PHP 5 entice me as a plugin developer (SimpleXML for example.) The conundrum arises in support of said features — do we include class files to bring inherent functionality from 5 into 4 or do we not support 4 at all? I am all for a move to 5, but as evidenced by the discussions on wp-hackers, hosts seem to have lackluster support for PHP 5. I don’t see this as a make or break issue for WordPress, but it will have an effect of great magnitude for future enhancements.

    Like

  2. While making PHP5 a minimum requirement maybe an extreme step, I guess one thing that WordPress needs to ensure is that it works flawlessly with PHP5 as well as PHP4.
    It ensures that those who do make the move shouldn’t face a problem.

    I had to patch my install to make it work with PHP5.
    I shouldn’t have needed this.

    Like

  3. I, as a PHP developer, love PHP5. The new features it brings to the table (DOMDocument for example) are reason enough to upgrade, in my opinion.

    I think your idea is the right one. It’ll encourage people to move on and up with the new version, allowing plugin and core developers to utilize features that will make life easier on everyone who writes code to support WordPress.

    Like

  4. Think of all the people who will have to switch web hosts if apps. switch to PHP5 only.

    These guys don’t care about the users. They just want to code in php5 only.

    Like

  5. As a user I wish that application take advanced of PHP5 but then when we lay on shared server, there is no chioce. Switch hosting is fair simple but it not the thing people want.

    The thing not just relate to WP or other leading web apps but there are million sites running other lagacy app which unable to run on PHP5.

    In some way WP may set a plan when will you abadon PHP4–it message to host for giving alternative choice for user–like some hosts providing option for PHP4 or PHP5. Say that WP 3.0 will only support PHP5 and left 2.0 series with PHP4.

    Like

  6. Announcing an EOL for PHP4 isn’t going to speed widespread adoption of PHP5 by a single day – the only thing that’s going to achieve that is a stable, bug-free, backwards-compatible release of PHP5.

    WP is already committed to 2.0.x for, what, four more years, minimum? I don’t think anyone would object too much to a more bleeding-edge PHP5-only WP 2.3 or 2.4 or whatever, so long as there remained a version with at least minimal security support that ran well on PHP4. Who knows, a new PHP5-only version of WP might actually live up to it’s hype, unlike 2.0 and 2.1…

    Like

  7. Ken…I’d rather play on your words . Think of all the people who want to switch to PHP5, but their web host providers don’t make it available. These guys don’t care about the users.

    The fact is that it’s not too difficult these days with Apache 2 to provide both PHP4 and PHP5 to the users. One of the more popular control panels, cPanel, has been stuck in the past with Apache 1 and PHP 4. cPanel is finally getting their act together and providing PHP5 and Apache 2 support with cPanel 11. I suspect that once cPanel makes available PHP5…most of the host providers (especially resellers) will be pushing PHP5.

    Actually, if I was with PHP.net…I would eventually just stop supporting PHP 4.x…especially once PHP6 hits the stage. JMHO.

    -Bryan

    Like

  8. Ken: we were not advocating to drop PHP4 support. I was suggesting that with every Drupal release, we make some of the new (non-critical) features PHP5-only, and gradually drop support for PHP4. That means that PHP5 users get something “extra” compared to PHP4 users. This might provide an incentive to upgrade to PHP5, or to go with a PHP5-enabled hosting company.

    Personally, I think it is important to invest in PHP, and to give back to the PHP project by helping them to make progress. At the end of the day, we depend on PHP, and if PHP dies, projects like Drupal and WordPress will die with it. (Random sign: according to O’Reilly Radar, PHP’s book sales are dropping.)

    How can we help to make sure that PHP is still alive and kicking 5 years down the road?

    Like

  9. “Announcing an EOL for PHP4 isn’t going to speed widespread adoption of PHP5 by a single day – the only thing that’s going to achieve that is a stable, bug-free, backwards-compatible release of PHP5.”

    Amen.

    If I was PHP.net I would put my best people on incremental speed and memory improvements to PHP 4.

    Like

  10. jmproffitt says:

    I tend to agree with the other commenters recommending that a future WordPress revision draw a line in the sand: WP 2.x or 3.0 will ONLY run with PHP 5. End of story.

    PHP.net may or may not EOL PHP 4 on a “reasonable” timeframe. You can’t control that. But you can control the direction of WordPress. So set an EOL plan for WP 2.x at some future date that allows for a transition. Then set WP 2.y or 3.0 as a PHP 5-only release.

    Sure, some hosts won’t move ahead. Sure, some users would be “left behind.” But the old code will continue to function on old PHP implementations — you’re not really cutting people off. Fact is, I can still load up a Windows 98 machine today. No one supports it and it’s wildly outdated from a security perspective, but I can do it if I really want to.

    Anyone who is “serious” about blogging and the WP platform will keep pace, even changing hosts to get the right environment. I guess I just wouldn’t wring my hands about it too much.

    Like

  11. Exactly – the situation is of php.net’s creation by the decision to support php4 and 5 in parallel. It’s a bit late now…

    Like

  12. I do a lot of development for a couple entities within an educational institution, and they won’t switch to PHP5 either. Part of the reason is that they have a lot of in-house written “utilities” that would break and they don’t have the resources fix them. The other problem is that a lot of the servers run Solaris 5.9 – good luck compiling PHP5! We certainly haven’t had much luck, and, once again, not enough resources to figure it out. It’s a pain. Any time I want to do something with XML or RSS, I have to pull crazy code out of my ass instead of just using SimpleXML. None of the servers have CURL support either – FUN times.

    Like

  13. My hosting company actually provides a choice of PHP4 or 5 – with 4 the default. I was looking to implement a plugin recently that actually requires 5 (although other factors prevented me from doing so) so switched versions.

    PHP5 actually seemed to resolve a LOT of problems I’d been seeing, particularly with performance.

    There has to be a balance where applications drive platforms, but maintain compatibility – hosting providers WILL offer PHP5 if the demand is there (they’ll have to), but applications will fail if they have requirements that aren’t easily provided. /Requiring/ PHP5 at this stage seems unreasonable.

    Like

  14. Mosey says:

    Thankfully my host already uses php5 and the transition for most scripts have been fine :) Maybe it will be good to encourage people to encourage their hosts to change to php5?

    Like

  15. Host like lonex or blue host adopted a partial solution, offering the switch php4 – 5 option in cPanel. I have now php 4, and moving in to php 5 is a hard decition because the host dont offer any responsabilities that the script will run properly. when i will 100% sure that may scripts will behave properly in php 5, i switch.

    Like

  16. “These guys don’t care about the users. They just want to code in php5 only.”

    I think we just found the one guy still running IE3. Sure CSS support is better in Firefox or IE 7 but those developers just want to code without hacks.

    Like

  17. Pingback: SigT
  18. I’ve always wondered if WordPress was going to ever be compatible with both (offer both php4 and php5).

    I can choose to run either on my server, and PHP5 is defaulted with PHP4 as a fallback if I’m running a PHP4 application.

    I’d love to see WP on PHP5.

    Like

  19. I’m with you, Ryan. PHP4 has no death in sight. Without an EOL announcement, and as long as PHP5 (and its development) continues as an adolescent teenager (complete with “this is who I am, deal with it” rants), PHP4 will live on.

    And to Johnathan Lyman, WordPress (usually) runs fine on PHP5. It just doesn’t use any PHP5-specific functionality.

    Like

  20. Hosting Provider says:

    Greetings All,
    Here’s an interesting thought that I notice
    no one even considered:
    It is just this side of IMPOSSIBLE to run both
    PHP4 /and/ PHP5 on the same box.
    YES. Is is possible. But NOT with any REAL
    stability. And NOT with any dependability.
    There are a myriad of reasons hosting companys
    aren’t jumping to make the switch to PHP5;
    They are NOT provided with any approved/
    recommended/confirmed documentation by
    php.net to run both PHP4 and PHP5 on the
    their hosting boxes. If they are /forced/ to
    move to PHP5, they will need to migrate
    100′s of 1,000′s of lines of code that will cost
    $1,000′s of dollars to accomplish (more than
    the cost of keeping/adding PHP5 want-to-have
    clients). PHP.NET themselves run their own
    servers (not just their web sites) on PHP4.
    A change to PHP5 would cost /them/ and you
    the user time and money.
    Bottom line:
    Until there is an acceptable and consistent way
    to provide PHP4 /and/ PHP5 on the /same/ box
    (server) this discussion is moot – pointless.
    If you want the change, discover and document
    a consistent and acceptable way for a server to
    run both PHP4 and PHP5 on the same server.

    Like

  21. Hi, I am a noobie – just building my own site right now. Can anyone tell me what are the main issues here? I mean what are the flaws that PHP5 fixes in PHP4?

    Thanks.

    Like

  22. I am not very interested in moving towards php5 either, i think once move environments are standardized like this then i will most likely move with that.

    Nice Article.

    Like

  23. Ben Wallis says:

    PHP 5 is backwards-compatible for the most part. PHP 5 can run PHP 4 classes – I don’t see the problem with writing backwards-compatible PHP 5 scripts.

    But PHP 6 is being released next year, so maybe we should skip PHP 5 all together?!

    Or why not write WordPress.com in PHP 4 and WordPress.org in PHP 5?

    Like

Comments are closed.