WordPress 3.0 and PHP 4 – What’s the deal?

I know that more and more wordpress developers are complaining about that coding policy to support PHP 4 in wordpress. Yes, you’re right, it’s pretty much useless these days. And it makes things complicated. But WordPress Development is not done the way that developers can actually decide on the topic. I hope this changes with more “open source development” in the project.

There is updated information: WordPress drops PHP 4 in Q1 2011 (by hakre; 14 Jul 2010)

I must admit, that this story is really old. We had the one or other shizophrenic situation already and yes, it creates a more and more floweriness garden. Springtime is over soon in the northern hemisphere but not yet. Today I stumbled over some wordpress 3.0 fresh in this cycle added code that looked like it wanted to “handle PHP 4 code” properly. But as I showed in my previous post about PHP References, just passing an argument as PHP variable reference does not do the trick.

So what to say? This PHP 4 compatibility is too complicated for todays wordpress developers to manage properly. I mean it’s totally stupid for a PHP developer to care about that carefully 2010, so I hope those guys do not take an offence when I write this. I can totally understand that this topic is too complicated that you want to learn the details and how to properly deal with it. My suggestion here is clear: Drop PHP 4 support with WordPress. Just drop it. Do the step ahead on the 3.0 release. It’s about time.

If you’re still running your wordpress blog and PHP scripts on PHP 4, consider to read on in codex on how to switch to PHP5.

Related tickets are: #13319; #9751. Related articles are: WordPress and PHP 5: Be the Change You Want to See; WordPress System Requirements.

Read on: PHP 4 end of life announcement (on my Blog, 31 May 2010)

This entry was posted in Hacking The Core, Pressed and tagged , , , , , , , , , , . Bookmark the permalink.

33 Responses to WordPress 3.0 and PHP 4 – What’s the deal?

  1. John Kary says:

    Aaron Brazell, author of The WordPress Bible, defended WordPress continuing to support PHP4 and explained their versioning system (or really, the lack there of) in this March 2010 podcast: http://www.phparch.com/2010/03/23/podcast-2010-04-technosailor-moon/

    Marco really nails it in the podcast on his points for of abandoning PHP4 in WordPress.

    • hakre says:

      Thanks for commenting and giving that link, that was an interesting Podcast. You write it yourself, PHP 4 is a kind of defensive point to take. From the arguments side I bet this is 100:1 for PHP 5 and that’s why defending PHP 4 in WordPress looks so ridiculous. I mean, you can not tell your users to keep current and then support far outdated software.

      What Aaron is saying in the Podcast I think his base line of argumentation is that most PHP Developers related to WordPress are not “real developers” (whatever that real means, I mean there is a practical use of programming, not only academic). How I read him is, that he wants to make bold that those developers are not “advanced enough” to cope up with PHP 5. But in fact it’s the other way round: PHP Variable References are hard to understand and PHP 5 made this more easy.

      The next big point he makes is backwards compability. I mean that one is over the top, because PHP 4 should only be supported in areas it is a true need because the software running on it did not upgrade and will break on a recent PHP version.

      For WordPress this is not the case, WordPress is already PHP 5 compatible. So the point should be to handle both: Backwards compability but also to keep current with the PHP software base. And the PHP 4 base is far way over and outdated. There is actually no need to support it. Every host can acutally offer a PHP 5 installment.

      About Matts 10% usage limit for a change: I have to admit, that those numbers are changing from time to time and the whole process is not defined and far away from transparent. I always saw this as a way for core developers to have some factual corner-stones to decide (and for others to know) when to make the switch because there was already much pressure to change the requirements to PHP 5.

      But since the stats and the number on the bar are under control by Automattic or even Matt personally (if I heard that right in the podcast) it’s just a way to blend-light demanding developers. The stats are only released from time to time and initiatives to alert your users to alert them on security issues regarding to outdated PHP versions were not taken. The original title a year ago was: “Let’s do not rush things”.

      What if 12% of all wordpress installments are running parent-less on some forgotten host? WordPress would never change the requirements. I’d like to see those stats per WordPress Version number and the like, but you will only get the stats with much luck – probably by accident? It was always offered to make the stats public continuously, but until today, that has not happened.

      Left is only the argument, that top-notch plugins are forcing wordpress users to make a change. This will happen now more and more often because, all the plugins libraries for let’s say Facebook and such sites will only support PHP 5. So there is some light at the end of the tunnel – if that really makes a change finally.

      I mean any (serious) WordPress user runs her or his installs on PHP5 “already”. So again, what’s the deal? I guess they have focussed so much on not switching to PHP 5 that they are not in the position any longer to rethink the decisions they made. It would have been too easy to tell those users who are not aware, that they take the switch.

  2. Fabry says:

    Yes, drop PHP 4 support with WordPress!

  3. Millan says:

    I too would like to see stats of PHP4 usage with WordPress because I know that there is such data gathered from core and plugin updates. I am also sure that 10% is too big a number, because many (or all) complex plugins for WordPress require PHP5. If you check the repository, you will easily find tons of plugins with PHP5 as requirements, so if anyone wants to use them they can’t be still stuck on PHP4.

    My GD Star Rating plugin doesn’t support PHP4 for quite some time now. And there were few support questions about it, but no real complaints why PHP4 is not supported. Same case is with my xScape Theme Framework. Some plugins still work with PHP4, but I don’t bother to test with it anymore.

    For last year or so PHP5 is a required platform for WordPress, and so far WP core is the only link in the chain that refuses to acknowledge that. As soon as WP core removes PHP4 support that soon we will see that last 5% of users on PHP4 finally do something about it and find decent host for their websites. One more thing, most users who are running PHP4 do that on hosts that support PHP5, but users are not aware that there is a way to switch it easily using HTACCESS or they hosting ControlPanel.

    • hakre says:

      I can confirm your last point, I have experienced that in support as well. With one larger plugin package we implemented a warning for PHP 4 hosts which turned out to be something very productive. Not only was that no problem for those to change. A big share of PHP 4 users actually thought they were using PHP 5. So they were very thankful for the hint. Good to see other are experiencing the same.

      • Millan says:

        Yes, and I simply don’t understand the stand that WP Core should remain PHP4 compatible at all costs.

        I understand that it’s too late for that to happen with WP3.0, but right now they should start campaign to remove PHP4 from WP3.1. In the next 4-5 months users who are still using PHP4 should be made aware what they can do to switch (in most cases they host already has PHP5) and why. I am sure that all developers will join in this and will start promoting idea helping the transition for few percents of remaining PHP4 WP users.

        But, from what I have seen so far, WordPress will remain silent on this (or will dismiss it altogether), and PHP4 will be still supported in WP 3.1, and I am afraid in WP 3.2 also.

        • hakre says:

          Well actually I can not confirm that this is “too late” for WP 3.0. In fact, technically, the requirements for PHP and MySQL are checked prior to the update so this can not be too late. Or do we have a release yet?

          But as pointed out, technical requirements or factual argumentation is not the problem here I suppose. So this requires actions on the Meta-Level – next to making the statement more and more bold.

          • Millan says:

            It’s too late to convince anyone now. The decision to stick with PHP4 with WP3 has made some 6 months ago when WP3 was starting development process.

            It’s funny, but WordPress is one of the last big CMS system still defending PHP4. Joomla 1.6 will be PHP5 only (even now from 1.5.6 PHP4 is not supported), Mambo dropped PHP4 year ago, Drupal 6.2 will be PHP5.2 only.

      • John Havlik says:

        Not sure if you noticed this yet, but I’m doing a “Die on not PHP5” statement in Breadcrumb NavXT 3.5. It’s too late to be “friendly” about it as we’ve just let the user see an error for over a year now. The bulk of complaints I get (about this) now days are people who thought they were running PHP5 but actually were not, the rest just can’t seem to read a FAQ.

        WordPress should allow us to specify PHP5 as a requirement, just like the minimum WordPress version in the plugin directory (and then it should check this on plugin activation). If WordPress is going to continue supporting PHP4 it needs to do something like this. Otherwise, it should just drop PHP5 support.

        • hakre says:

          There are some nice ideas within your comment. I had just asked myself if it’s possible to provide a plugin that is doing exactly that job. Are there any plugin-headers that can signal the minimum PHP version? If not this is something valuable to suggest as a feature request.

          • John Havlik says:

            The last I checked there were no plugin headers for minimum PHP version, something that should be changed if the WP core is not going PHP5 only within six months.

  4. I’ve been testing WP 3.0beta2 and struggling with an in_array() bug that showed up on Posts. It was really ugly in IE but looked normal in FireFox except for the error message at the top of the page.

    The biggest challenge I had was that one of my test websites had the problem and the other didn’t.

    What I discovered was that my older test site was still running php4 and it was the one with the error. When I upgraded the site to php5 the problem went away. This discovery was a bit embarrassing because I, too, have been harping about how everyone should be on 5.2 or later… and I missed it on one of my sites, though a test site.

    I guess my point is this: WP may be moving to a php5 requirement and not even know it. It’s certainly the smart thing to do.

    • hakre says:

      Absolutely, that is what I suggest to all of my friends and customers: Take a recent PHP 5.2 version at least if you wanna be safe in running WordPress.

      For sure there are multiple bugs and flaws in WordPress running with PHP 4. Unregistering Filters for example is just not working. That has nothing to do with backwards compability or the like.

      It’s a fault to assume that WordPress does properly support PHP 4. As developer or dedicated users, we should call this PHP 4 requirement of wordpress more publicly what it is: a myth.

      And if you as WordPress user wants to support your themer or plugin dev: Just do the switch. Do not trust the requirements written on wordpress.org. Listen to your friends instead.

      • Millan says:

        Exactly, WordPress supports PHP4 but selectively. Some features will not work in PHP4 is the same as saying WordPress requires PHP5. What would happen if Adobe makes new Photoshop and says that in Windows 7 everything works, but in Windows Vista you can’t use mask tool? That’s the same with WordPress right now. And saying that it will ‘gracefully degrade’ is not good excuse for keeping support for old and not even supported software, that has too many bugs like PHP4.

      • Millan says:

        And one more thing on WordPress on PHP4. In the past 6 months I worked on several customizations: tweaking performance, solving problems with websites. 2 websites used WordPress 2.7 and 3 were on 2.9. Even with all plugins disabled on all of these websites there are problems that are solely caused by PHP4. And clients used it because WordPress says it will work, and the fact is that it doesn’t. I was trying for hours to set those servers, trying different configurations in PHP4 and only on 1 of these 5 websites I managed to set it to work. And even that went away when I activate first plugin that wasn’t working with PHP4, and there are many, many plugins that require PHP5. Check out the list of most popular plugins in WP repository and you will find handful that will work with PHP4.

        Let’s stop pretending that PHP4 with WordPress works when the experience of most users and developers says that it doesn’t.

  5. Alex M. says:

    This is a serious question: why should PHP4 support be dropped?

    We don’t let PHP4 hold us back — there are multiple features in WordPress that require PHP5. If you have PHP4, the features simply gracefully degrade.

    I have yet to hear a convincing argument as to why we should drop PHP4 support.

    (For the record, all of my servers run the latest versions of PHP 5.2.x or 5.3.x and have done so for quite a long time.)

    • hakre says:

      Well, for what do you propagate the usage of PHP 4? To run wordpress with it while even you do not do that? Wouldn’t it by far out be a much more serious suggestion to anyone who uses PHP 4 to update their version? The faster the better? Shouldn’t that be the message to get out?

      And that’s from a some-users perspective only. Not to mention which implications this PHP 4 policy has for todays developers which are users as well – WordPress is a free and open source project, right? Most of todays PHP developers are much more safe with PHP 5 variable handling (and coding BTW) as with PHP 4. Seriously.

      PHP 4 should be nothing to defend here. Neither from the end-users nor from a developers perspective.

      And for the log: WordPress does not gracefully degrade on PHP 4. That’s a myth already for now and this naturally will increase with every upcomming version.

    • filosofo says:

      We don’t let PHP4 hold us back — there are multiple features in WordPress that require PHP5. If you have PHP4, the features simply gracefully degrade.

      There are several problems with this approach. First, WordPress can never substantially use the improved syntactical changes of PHP 5 as long as it supports PHP 4. Not using a few PHP 5-specific functions (what happens now for PHP 4 folks) is not the same as the more fundamental and wider-ranging changes that a different syntax allows. And we are being held back from using them in core WordPress currently.

      Second, users who get a degraded experience will assume that it is WordPress’s fault. Unlike like an IE 6 user, who is reminded of IE’s shortcomings around the web, the PHP 4 user associates the diminished experience only with his site and therefore WordPress.

      Third, having a backwater of code that developers pay little attention to is just asking for trouble. It’s an opening for unnoticed bugs and security issues for PHP 4 users.

    • Jesse Taylor says:

      Because supporting it creates unnecessary code bloat, and makes things less efficient and harder to maintain.

  6. Millan says:

    I have published an article on the subject: http://dv4p.com/wr

    Hopefully more developers and users will join in to push the PHP4 out (finally).

    • hakre says:

      Spread the word. PHP 5.2+ FTW.

      Every developer who hasn’t yet pushed that stinky PHP 4 out of his plugins/themes has an adverse opinion against his or her own userbase if you ask me. It’s a need to clearly educate into that direction at least.

      I’m just wondering if this would get some traction and positive moves if plugins could finally signal which PHP version they need as John Havlik suggested. I think about creating a ticket so this feature is in core and to put some code online so that plugin developers can throw a warning to their users and scare them like hell like Matt did :P.

  7. Pingback: Stripslashed to death? – End the Madness! | hakre on wordpress

  8. Pingback: New Trac Report: {37} Needs Unit Tests | hakre on wordpress

  9. Pingback: PHP 4 end of life announcement | hakre on wordpress

  10. Pingback: WordPress as a business PHP 4 Example | hakre on wordpress

  11. Tony says:

    I stopped upgrading WordPress at release 2.8.6 because I am on Yahoo hosting which has PHP Version 4.3.11, MySQL Server version: 4.1.14, and doesn’t allow .htaccess files.

    Although I could change to a web provider that has more current software, moving a big integrated web site would be a lot bigger hassle.

    WordPress changes too fast. Every time I turn around there is a new update.

  12. Mitch says:

    One of the problems with all of this is that some of us are stuck with PHP 4.0. My host won’t move it for me and I can’t move it myself because the file is more than 2.5MBs in size, which is the limit the host will allow you to move a backup file to. I was able to get them to move one of my blogs, but they said no to the other two. The easy thing to say is to move to a different host, but that’s often problematic, plus it’s the only gripe I’ve had with my host.

    • hakre says:

      The other option would be that your webhoster provides PHP 5 on the same host. So that would be nothing for you to change. No need to move sites normally.

  13. Pingback: WordPress drops PHP 4 in Q1 2011 | hakre on wordpress

  14. rahul says:

    my host telling me that he has php 5.0
    but still i am not able to install wp3.2
    why ??

    • hakre says:

      I don’t know your skills, so I can only assume that you are just too unexperienced to get it done. Just try to better understand what you’re trying to do and I’m pretty sure you’ll get it managed in no time.

  15. Arnulfo Elhosni says:

    You made some clear points there. I did a search on the issue and found most people will go along with with your site.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.