{"id":3064,"date":"2014-01-22T18:04:38","date_gmt":"2014-01-22T17:04:38","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=3064"},"modified":"2014-01-22T18:04:38","modified_gmt":"2014-01-22T17:04:38","slug":"why-wordpress-should-drop-php-5-2","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2014\/01\/why-wordpress-should-drop-php-5-2\/","title":{"rendered":"Why WordPress should drop PHP 5.2"},"content":{"rendered":"<p>There&#39;s a recurring debate about WordPress and whether they should keep code compatible with PHP 5.2 or drop it and bump the requirements to a newer PHP version. Hey, I have an opinion on this.<\/p>\n<h2>What&#39;s wrong with PHP 5.2?<\/h2>\n<p>Nothing much, except PHP 5.2 was released in <a href=\"http:\/\/en.wikipedia.org\/wiki\/PHP#Release_history\">November 2006<\/a>, and was maintained and developed till January 2011. This means that it&#39;s now considered an old release, rusty  dusty code that&#39;s no longer improved, and should a new vulnerability be discovered in the 5.2 branch, it will remain unfixed.<\/p>\n<p>In short: it&#39;s *old*. Any PHP library you&#39;ll find these days requires 5.3+.<\/p>\n<h2>Old but still everywhere ?<\/h2>\n<p>According to W3Techs, <a href=\"http:\/\/w3techs.com\/technologies\/details\/pl-php\/5\/all\">33% of websites<\/a> running PHP are on 5.2. That&#39;s a lot, but wait, there&#39;s worse.<\/p>\n<p>According to WordPress, <a href=\"http:\/\/wordpress.org\/about\/stats\/\">more than 50%<\/a> of WordPress-powered sites are still on 5.2. Earlier this week <a href=\"https:\/\/twitter.com\/dd32\">@dd32<\/a> made a <a href=\"http:\/\/i1.wp.com\/dd32.id.au\/uploads\/2014\/01\/WP-PHP5-over-time-yearweek.gif\">pretty graph<\/a> showing that PHP 5.2&#39;s share is only slowly decreasing.<\/p>\n<h2>So what?<\/h2>\n<p>Dropping a platform running half of your user base would be crazy, right? For sure. Except I think the numbers are somewhat skewed.<\/p>\n<p>As you may know, my pet project is a self-hosted URL shortener, YOURLS, which was <a href=\"https:\/\/github.com\/YOURLS\/YOURLS\/releases\">released<\/a> in its version 1.7 earlier this month. This new version comes with a phone-home feature to report the same kind of stats that WordPress is aggregating from its users, and particularly what PHP version YOURLS is installed on.<\/p>\n<p>Of course, the YOURLS user base is nowhere near as important in volume as WordPress&#39; market, but I think the average user is similar, so YOURLS figures should be relevant in some way.<\/p>\n<p>What I&#39;ve learned since the release of YOURLS 1.7 came as a surprise: I was expecting a similar share to what WordPress reports, but it turns out only <strong>10% of YOURLS installs are running on PHP 5.2<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"315\" src=\"http:\/\/planetozh.com\/blog\/wp-content\/uploads\/2014\/01\/yourls_php_version.png\" alt=\"yourls_php_version\" class=\"aligncenter size-full wp-image-3066\" srcset=\"https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2014\/01\/yourls_php_version.png 332w, https:\/\/planetozh.com\/blog\/wp-content\/uploads\/2014\/01\/yourls_php_version-300x284.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/p>\n<p>What did I conclude from all this?<\/p>\n<h2>1. Old installs <em>vs<\/em> new installs<\/h2>\n<p>WordPress is old, it&#39;s been around for 10 years. The typical WordPress user installed WP 4 or 5 years ago, when 5.2 was still the standard.<\/p>\n<p>YOURLS is much younger, it&#39;s been around for 4 years, but the project sort of picked up 3 years ago with YOURLS 1.5, released in November 2010. The typical YOURLS user installed YOURLS 1 year ago, when the default hosting setting on most host was PHP 5.3 or more.<\/p>\n<p>I think that&#39;s the key of the skewed numbers : simply too many WordPress installs were around when PHP 5.2 was the default, and those users just did not upgrade their hosting. Well, why would they, it just works fine.<\/p>\n<p>That would be <strong>exhibit A<\/strong> : newer users are on 5.3+, older are <em>still<\/em> on 5.2.<\/p>\n<h2>2. Deeper digging: who&#39;s running PHP 5.2?<\/h2>\n<p>Most host, if not all, still offer 5.2, even if you open an account today, but I could not find any which does not support 5.3+. All the major hosts (Dreamhost, Bluehost, Hostgator, etc&#8230;) have 5.3 by default.<\/p>\n<p>And if there is a minor host where PHP 5.2 is the best you can have, then what&#39;s the point with signing with a smaller and lesser known company if they cannot provider better services than big ones?<\/p>\n<p><strong>Exhibit B<\/strong>: hosts can give you 5.3+<\/p>\n<h2>3. WordPress should lead<\/h2>\n<p>And that will be <strong>exhibit C<\/strong>: WordPress has the power.<\/p>\n<p>WordPress runs on 20% of all websites in the world. That&#39;s <strong>huge<\/strong>. Moreover, it apparently has <a href=\"http:\/\/w3techs.com\/technologies\/overview\/content_management\/all\">60% of the CMS market<\/a>, which is also very impressive.<\/p>\n<p>Few organizations in the world have the power to say &quot;we&#39;re moving to a newer version of PHP&quot; and have a global impact ; WordPress is one of them.<\/p>\n<p>With such an influence, WordPress should even go a step further and pro-actively announce end of support for PHP version and follow <a href=\"https:\/\/wiki.php.net\/rfc\/releaseprocess\">PHP&#39;s 3 year release process<\/a>, instead of simply watching user adoption. PHP 5.3 will be maintained till July 2014, PHP 5.4 will be maintained till March 2015: I think WordPress should announce the same minimal requirement changes.<\/p>\n<h2>TL;DR<\/h2>\n<p>The day WordPress says &quot;we require PHP 5.3&quot;, the whole web which is still running 5.2 switches to 5.3. Simple as that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There&#39;s a recurring debate about WordPress and whether they should keep code compatible with PHP 5.2 or drop it and bump the requirements to a newer PHP version. Hey, I have an opinion on this. What&#39;s wrong with PHP 5.2? Nothing much, except PHP 5.2 was released in November 2006, and was maintained and developed [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[404,10,74,245],"class_list":["post-3064","post","type-post","status-publish","format-standard","hentry","category-published","tag-5-2","tag-php","tag-stats","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/3064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=3064"}],"version-history":[{"count":5,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/3064\/revisions"}],"predecessor-version":[{"id":3070,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/3064\/revisions\/3070"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=3064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=3064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=3064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}