PHP Version Adoption
Join the DZone community and get the full member experience.
Join For Freephp runs over 75% of all websites whose technologies are known (source: w3techs ), which makes for a really really long tail of users who once installed wordpress, phpmyadmin, or some other open source project that helped their business needs at the time. what they don't do is upgrade . php's current usage statistics look like this (source and raw numbers are if you want them):
what's alarming about this is that the left half of this graph represents unsupported versions of php . php 5.2 has been end of life since january 2011. this doesn't mean that you can't use it any more, but it does mean that in terms of security updates, you are out of luck. some distributions will try to retro-fit some of the fixes but essentially your php applications seem a bit lacklustre because, well, you're using technology from 2006.
where to go from here
nobody chooses a php 5.2 platform, these things just happen, and i absolutely don't mean this post as a rant - more as a way of raising the issue and trying to give some pointers for moving forward. when i work with organisations to upgrade their platforms, usually either their hosting company is living in 2006, or they have a "supported" distro which prevents them from using modern technologies, or there's been no budget to upgrade, or ... really there are lots of (really valid) excuses. however good things await in newer versions of php!
php 5.3
has actual useful oop features! we have anonymous functions (this feature will change your life, and for js developers especially will make your php make more sense), the spl extension is more than just iterators, and the datetime extension is fabulous and finished in php 5.3. also in php 5.3 (released 2009, it's not cutting edge) is the vitally important
e_deprecated
error reporting flag. this will identify any features you are using in the current version of php which won't be available in the next version - if you are on php 5.3, or can get there, your upgrade path gets much easier! if you have a living php application, i can't recommend this move strongly enough.
php 5.4 has some cute new features, but whether you need them or not, php 5.4 has faster execution time and reduced memory footprint. here's the graph from some benchmarks i did between versions of php last month - the y axis is the number of seconds each version took, on average, to run the benchmark script included in the php source tree (raw numbers are available in a gist ):
whether you want to be able to use traits or not, php 5.4 will improve the performance of your application and reduce your hardware costs ... all you have to do is upgrade between versions of free software. why isn't the php 5.4 segment on the first graph bigger? there are some explanations, such as the lack of apc, for this version, but nothing that seem compelling to me (happy to hear your stories in the comments).
php 5.5 isn't actually production-ready, as we're still in the release candidate phase for it, but it's probably weeks away. look out though, a more regular release cycle for php means that there will be smaller incremental changes and we'll all be upgrading php the same way we maintain our other software - so pretty regularly. beyond php 5.3, the effort and risk in upgrading is much reduced.
the future
in truth, the future is already here for those people on php 5.4 and beyond. keeping php upgraded is just part of our regular maintenance workflow, and the language is progressing in regular and manageable steps. if you've been left behind then i strongly recommend that you start making plans for upgrading your platform, or moving to a newer one. the effort will be well worth it when your application is still evolving and performing for many years to come! if any other platform gave away such incredible improvements in features and performance for free, it would be big news. let's make it big news in php too.
Published at DZone with permission of Lorna Mitchell, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
How To Integrate Microsoft Team With Cypress Cloud
-
Never Use Credentials in a CI/CD Pipeline Again
-
Scaling Site Reliability Engineering (SRE) Teams the Right Way
-
Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends
Comments