DerekAllard.com

CodeIgniter will not be dropping support for PHP 4 anytime soon

There’s been renewed discussion about CodeIgniter moving to a PHP 5 only framework within the community.  This post is my attempt to articulate the point of view of the development team, and my personal reasons for why we will not go this route. 

First of all, let me just say this “I like PHP 5”.  A lot.  I use it exclusively for my personal development, and I want to see it adopted more.  I don’t like PHP 4 much, and in fact, I’d love to not need to support it.  But the fact of the matter is that the vast majority of PHP servers out there are still running PHP 4, and we want our products to be accessible for the widest possible audience.  We will not be dropping support for PHP 4 anytime soon.

To know why, one need only look at recent PHP Usage Statistics.  Here’s December:

PHP 5 usage statistics for December 2007, and November PHP 5 usage statistics for November 2007

I won’t bother with the graph, but here’s six months ago in June 2007.

Let’s put this into perspective.  The PHP 4 end of life announcement was made in July 2007.  And since July, PHP 5 has gained about 7% of market share (8% since June) and it seems like that growth is still hovering a little over 1% a month.  I am looking forward to seeing the results for January, since December was the last month for PHP 4 support, according to PHP.net, but I doubt it will make much difference.

At the current rate of adoption, we might be able to switch over CodeIgniter to PHP 5 only some time in August 2010, assuming we would require >70% PHP 5.x usage and 8% adoption every six months.  I don’t even want to think about PHP 6.

So what are our plans for PHP 4 support?  We make software for the real world.  I assure you that when PHP 4 becomes as irrelevant as PHP 3, that we’ll drop support for PHP 4.  That said, most of the areas where speed would matter we have pulled out anyhow.  There’s some smart coding going on.  If you check system/codeigniter/ you’ll see base4 and base5 for handling the super-object.  base4 gets loaded on (wait for it) PHP 4 systems, and base5 on PHP 5, so much is already nicely separated.  In truth, if you do your own programming in PHP 5, there is little to gain practically.

The fact is, PHP 4 still works great for the majority of things, and if you have PHP 5, then there is no reason you can’t leverage it.  That is what I’ve done with BambooInvoice.  It simply won’t work on PHP 4, and there are lots of PHP 5 only magic things going on in there… but at the core, its still built on CodeIgniter, thus reinfocing my point that you can build PHP 5 apps in CodeIgniter without much loss.

CodeIgniter is about getting things done in the real world of deadlines, shared hosts, crazy clients and uncontrolled environments.  When that means PHP 5, then I assure you that CI will drop PHP 4 support, and adopt full PHP 5, or 6 or 7 as is warranted. Hopefully my flying car will be out of the shop by then so that I can have my robot butler prepare my food-pill a bit early that day and I can pick it up.

Edit: Stats from http://www.nexen.net.  Here is their full December PHP adoption article for your perusal.  Much more interesting information in there.
Edit (March 9, 2008): A commenter has requested to have their comments removed, and I’ve done so, so some of the comments may seem out of context.

Comments

Chris wrote on

Totally agree with the thinking behind this, especially ‘we make software for the real world” - I would LOVE to be writing just PHP5 but I’ve found in the real world a lot of clients have existing hosting arrangements and they’re not willing to change them and those hosts still use PHP4. Is it annoying? Hell yes, but I’m SO grateful that Codeigniter still supports it so I can still use super-fast MVC goodyness! Thanks Derek!!

PS - I think paragraph 2 sentence 3 might have typo - ‘I don’t like PHP much’, think you might have missed a ‘4’ outta that ;o)

Derek wrote on

Whoa Chris… thanks.  ;)

Take about your Freudian slips there…

Jonathan Snook wrote on

Is that right? PHP4 has about 70% market share? I find that very surprising, especially after hearing about dropped support. Good to know, though.

Jakob Buis wrote on

You provided some valid points here; but I’m still convinced PHP5-only is the way to go, as it wil give us:

1) Increased adoption of PHP5 (why switch if you don’t need to?)
2) Faster development for CodeIgniter (less platforms to support and test for == less work == more time left == more vacation for you AND more great features in CodeIgniter for me :) )

But hey: Since CodeIgniter has a community, why not have them vote?

Derek Jones wrote on

It’s a common misconception that if developers only wrote in PHP5 that hosts would somehow be “forced” to start supporting it.  Hosts notoriously tell clients to use different software, and spread FUD to avoid having to make changes to their business model.  Such attempts by developers to make the change by this type of hunger-strike-esque protest are only going to hurt themselves and their users.

I mean, when you look at what’s profitable in hosting, hosts don’t really want to host your PHP application anyway, much less bend over to PHP developer demands.

Chris wrote on

I also was surprised that PHP 4 still had a (massive) 70% share - I was working from personal experience but that seems to extrapolate out to the wider world.

The other major benefit of CI continuing v4 support is for those developers working on open-source projects (yes, I know Derek wrote about Bamboo being v5+ but that’s a project likely to be installed on developer’s local machines rather than commercial hosts). I’m working on a open-source project - hehe! which of us doesn’t have some code in the pipeline ;o) - and I would be very cautious of releasing it for v5+ only, simply because I’m wanting as wide an adoption area as possible. Bottom line: Yes, it’s all very annoying but we’ve survived IE v3 through 7 so perhaps slow PHP adoption rates is just the next great ditch that karma has left us to leap!

(Must say though, if I gotta weather a storm I couldn’t think of a better group of folks to do it with than the CI community!)

Lewis wrote on

But what you don’t understand is that hosts won’t upgrade as long as people continue to develop with PHP4. There’s no possible reason not to upgrade to PHP5 (except laziness) and by continuing to support a version that’s obsolete you’re stopping PHP’s growth. It’s a vicious circle but you can’t just keep going round and round.

Eric Barnes wrote on

This is very good news to me.  PHP 5 may be the greatest thing since sliced bread but if the majority of hosts are not going to support it then I am not going to waste my time building a product that some people can’t use. 

The fact is you can program in php 4 and it will continue to work in php 5.  Yea you may miss some feature but usually there is a workaround.

Nick Husher wrote on

I find the argument that programmers should code in PHP5 to force web hosts to adopt it is a bit like suggesting that web designers write their code in HTML5 and CSS3 to force browser makers to upgrade. It’s not a pragmatic approach: You’ll just piss off your clients or intended audience because their webapp isn’t available/displaying correctly.

Stick with PHP4.

Chris wrote on

I completely understand where you’re coming from with the whole ‘catch-22’ argument, I just don’t think that if we all magically switch to PHP5 then all the hosts will switch too - for a very simple reason, though we web professional types might be discussing it during the long hours of the night, the *vast* majority of their customer’s a) don’t care and b) don’t even *know* there’s an argument to be had - I wish that browser developers would i.e. a) adopt other scripting languages (i.e. Ruby), and b) adopt CSSv3

but come-on, this isn’t going to happen, and when putting a proposal to a client one can’t just argue Voltaire’s ‘the best of all possible worlds’ - I don’t think any of us (in the role of programmers) would argue against the adoption of PHP5, but I *honestly* don’t beleieve we have an alternative, sad as that may be - peace, C :o)

James Urquhart wrote on

Ah, it’s another one of those supply vs demand dilemma’s.

Though really you should know better than to rely on spider web statistics for something like PHP.  Remember that not everyone blurts out the PHP version in their server headers.

Thinking more, did you note what it said on the stats?

“domaines without web sites, those unreachable, ISP, shared hosters or domain parkings were not considered.”

That’s part of your target market, and it’s “not considered”.

In any case, it would be interesting to compare with the transition between PHP 3 and 4. :)

Jakob Buis wrote on

In any case, it would be interesting to compare with the transition between PHP 3 and 4. :)

True! Never thought of that…I’m way too young for PHP3 but maybe someone can enlighten me?

Derek Jones wrote on

Though really you should know better than to rely on spider web statistics for something like PHP.

Right, we don’t “rely” on it.  Derek’s sharing it as evidence of something that we already know because of our involvement with so many people that run our software all around the world.  That Nexen’s stats closely match both our anecdotal as well as our collected statistics is not surprising to us.

Thinking more, did you note what it said on the stats?
“domaines without web sites, those unreachable, ISP, shared hosters or domain parkings were not considered.”
That’s part of your target market, and it’s “not considered”.

I could be wrong, James, but I’ve always read that to mean that 100 shared hosting users on 1 server is still only counted as 1 server, indicating that the population isn’t skewed.  In any case, I’d find it hard to believe that the numbers for shared hosting would be much different.  Even less likely to be running PHP 5.

Colin wrote on

I was on the ‘stick with php4 bandwagon - it’s good enough’ but I found out php4 will only get security updates to August and I asked my host to upgrade to php5, which they did for free.  I’m thinking all it will take is one gaping security hole in php4 which won’t get patched to force hosts to upgrade accounts. (I have a stinking cold so I’m probably being too negative here :-) )

Ed Finkler wrote on

Much like Colin, I suspect the *actual* end of PHP4 support by the PHP group will accelerate PHP5. As that’s not happening until August 8 2008, I think we have some time to spare.

Also, it is interesting to see that PHP5 acceptance has been accellerating. Did you take that into account in your 2010 estimate?

But, I also don’t think PHP4 support is a *killer* for CI or anything. CI focuses on relatively simple, straightforward solutions, and many of PHP5’s new features tend to add complexity. Sometimes that’s necessary, but I don’t think they are to accomplish what CI tries to do.

sf wrote on

ROTFL :D What hosting do you have? In Poland hostings have PHP5.. (all top30), sorry but it is funny ;)

Milind Prabhat wrote on

Hi,
  I like this text box, but on IE-7 these are not work well if the comments are too large.
  Can u give me solution for this, Will text boxes work proper on IE-7.

Thanking you

thebestmind

Derek Jones wrote on

Alex, when you develop a product used by hundreds of thousands of people, all of your arguments for why PHP 5 is better become immaterial and reality sets in.  <sarcasm>I mean, look at the raving success of gophp5.org </sarcasm>

“Why support a legacy language?”

I don’t know about you, but I like food on my table.

“but if a framework wants to be stuck in the past and not upgrade than that is a big hint to move away.”

CodeIgniter works just fine with PHP 5 and makes use of many of its improvements.  And you control all of your application code, so I can’t help but think that this comment is either uninformed, or that you are just trolling.

Derek wrote on

Alex, did you read my post, or just see the title and start typing your response?

I am not arguing that PHP 5 is not superior. I am not arguing that PHP 5 is hard to find.  I am not arguing that PHP 5 should not be used.  I am not arguing that PHP 5 is expensive. In fact, I explicitly said that I’d like to drop support for PHP 4. 

What I am arguing is that CodeIgniter should help developers in the real world, and in the real world PHP 5 only accounted for about 7% of the market.  Let me re-iterate that when this number moves up, we’ll move to strict PHP 5.

Your second post is inflammatory, and you conveniently ignore all the arguments I’ve put forth.  “stuck on the past”?  What on earth are you talking about.  If anything, we aren’t looking into the future and dreaming about “what if”. 

Allow me to throw this out for everyone: When you build websites, do you build them to work only in Safari, Opera and Firefox 3?  These are clearly the “best” browsers available right now in a technical sense,  and offer considerable advantages over older browsers.

Tony wrote on

Alex,

You are glossing over and quite forgetting one point that Derek made earlier.

“If you check system/codeigniter/ you’ll see base4 and base5 for handling the super-object.  base4 gets loaded on (wait for it) PHP 4 systems, and base5 on PHP 5, so much is already nicely separated.  In truth, if you do your own programming in PHP 5, there is little to gain practically.”

CI gives YOU, the developer the choice of which super-object to use.

Weather you code your projects in 4 or 5 is completely up to (wait for it) YOU.

So what’s your point again?