Thumbnail Image

Date Posted: Sep 14 2016

Tags: PHP5, Programming, Webhosting, Wordpress

What ever happened to PHP7?

You may be thinking: "Wait, don't you mean what happened to PHP6?"

But no, I am actually referring to PHP7, This may seem quite strange since PHP6 was the version that was skipped, not PHP7.

A QUICK SUMMARY FOR THOSE THAT DO NOT KNOW

PHP6 was proposed sometime back in 2010, but was eventually suspended and never reached production phase. This was mostly due to the core features of PHP6 being deemed too technically difficult to implement; this in combination with multiple other reasons meant the development unfortunately reached a standstill.

Many of the features included in PHP6 were instead back-ported into the PHP5.x branch; explaining why we saw so many new features added with the release of PHP5.3.

The version name PHP6 was omitted by the php.net developers due to the fact that it was a very well established and documented project. There are still vast amounts of information available on the web regarding the PHP6 project; and many conferences were held by the php.net developers in the community regarding the project.

It made very little sense to reuse PHP6 as the name for the next PHP version seeing as the next version was completely different to the well documented PHP6 project. After much debate it was decided the next version would be named PHP7.

PHP7 IS RELEASED AND OUT THERE NOW

PHP7 was released on the 3rd of December 2015. Around this time a multitude of blog posts flooded the web boasting how PHP7 was "double the speed", "faster performing on many popular frameworks" and had "improved server caching" amongst many other claims of improved performance.

Soon after being benchmarked and tested by several significant PHP driven websites, frameworks and applications; vast amounts of evidence to back up the performance claims of PHP7 promised by the php.net developers began to appear.
By focusing on the core of PHP and changing how the internal structures operate, the hash-tables are now far more efficient and the data structures have been greatly reduced in size. These improvements have resulted in less memory requirements and faster operation.

Multiple new features have been included in PHP7 including:

  1. Anonymous Classes (Commonly seen in other languages such as Java and SCALA)
  2. More Accurate Type Declarations
  3. 64bit Windows Support (WAMP Stack users rejoice!)
  4. Improved Error Handling
  5. New and improved Zend Engine.
  6. Combined Comparison Operator "Spaceship Operator <=>"
  7. And much more

All of the new features sound like great additions to the language.
Not only do the new features sound like great additions to the language but, better yet, PHP7 has also kicked its hoarding habits and removed many of the deprecated functions; such as old, unsupported server APIs/Extensions. This has made room for new features and tidied up the language.

SO WHAT DO I MEAN BY "WHAT EVER HAPPENED TO PHP7?"

PHP dominates the market share for server-side languages, at the time of writing this article 81.9% of websites using a server-side language are utilising PHP.

Facebook and Mailchimp are two notable websites that utilise PHP. Facebook currently has over 1.71 billion active users per month, and Mailchimp sends billions of emails every month.

There is no argument against the fact that PHP can be utilised in remarkable ways.

However, taking a closer look at the market share statistics we find that surprisingly only 1.3% of PHP websites are currently using PHP7.
What's even more alarming is that 1.1% of PHP websites are still using PHP4 which was deprecated in March 2005.

There are currently nearly as many PHP websites using deprecated versions of PHP as there are PHP websites using the newest stable version PHP7.

This seems a rather slow uptake, especially with the shelf life of PHP5.6 drawing closer every day: active support for PHP5.6 is planned to end on the 31st of December 2016.

WHY IS THE UPTAKE OF PHP7 SO SLOW?

With all the performance benefits and new features added in PHP7 you would assume more people would be pushing forward, and adopting the latest stable version to improve their server-side code of their websites, frameworks and applications.

So what is slowing down the adoption of PHP7?

BACKWARDS COMPATABILTY

The removal of deprecated functions to free up space for new features has been seen as a terrible move by many developers. There is quite a lot of controversy surrounding the necessity of removing the backwards compatibility of these functions.

Many PHP websites, frameworks and applications still support these deprecated functions. Refactoring a large codebase can take a considerable amount of time, and in many cases it is neither a quick nor easy job to replace these deprecated functions.
Many frameworks will also be removing backwards compatibility to their user base by doing so. This results in their user base also having to refactor their websites and applications if their chosen framework adopts the use of PHP7.

WORDPRESS PLUGINS AND THEMES

At the time of writing this article the highly popular Content Management System Wordpress is currently being used by roughly 26.6% of all websites.
Wordpress, which is built on PHP, has shown remarkably increased performance when using PHP7. Wordpress has been compatible with the use of PHP7 since Wordpress version 4.4.

It seems inevitable that Wordpress will soon be stepping up the recommended version of PHP to PHP7 as support for PHP5.6 comes to an end in December 2016.

"Wordpress is compatible with PHP7 so no problems for Wordpress websites right?"

Unfortunately it isn't that simple. Many of the top plugins and themes used by Wordpress users are not compatible with PHP7 as of yet. This could cause some serious problems for users that rely on these plugins for their Wordpress websites to function.

Fortunately WPengine have released a PHP7 compatibility plugin to check if your Wordpress website, plugins and themes are ready for the adoption of PHP7.

You can get this plugin for free from the Wordpress Plugin Directory:
https://wordpress.org/plugins/php-compatibility-checker/

Whilst the plugin does sound brilliant, I would strongly recommend that you do not only rely on this one plugin to check your Wordpress website for compatibility issues.
Make sure to also test your Wordpress website in a PHP7 test environment before pushing the changes to your live production environment.

SHARED HOSTING

The majority of websites are being run on shared hosting services.
Many websites have no need for their own dedicated server, or their owners simply cannot afford to pay the high costs of a dedicated server.

This is one of the reasons why we haven't yet moved CodeSmite to PHP7. Our code base is compatible and ready for PHP7, but our current webhost does not support PHP7 on shared hosting. In the future, we are hoping to move to our own dedicated server allowing us to have more control over such decisions.

Earlier this year, we spent a lot of time searching for a host that could provide PHP7 on shared hosting. Unfortunately, there were very few to choose from and many did not provide a suitable hosting package comparable to our current host. Aside from not providing PHP7 as an option on shared hosting, our current webhost has provided us with an excellent service across all of our projects.

I have recently gone to the trouble of contacting several reputable webhosts to find out where they now stand in regards to PHP7 and shared hosting. A good majority still do not support PHP7 with shared hosting. The lack of support is largely due to their use of heavyweight control panel systems, and also due to the unavailability of sysadmins to help them upgrade their packages.

This time however, I did manage to find a selection of reputable webhosts that provide multiple choices of PHP versions to their clients using cloudlinux; including the use of PHP7 on their shared hosting packages.

Out of the hundreds of webhosts I contacted, here are the selection of hosts that came back to me confirming that they do support PHP7 on shared hosting:

A2 Hosting
Dreamhost
Hosterbox
Geekstorage
Siteground

I WOULD LOVE TO DISCUSS THIS TOPIC WITH YOU READERS

Are you having trouble deciding on whether it is a good idea for you to move to PHP7?

Perhaps you have another reason, which I may have missed in this article, as to why you have not yet adopted PHP7?

Please let me know in the comments section below.

Author Avatar

BY CODIN

Owner of Codesmite.com

Codin is a self taught web developer based in London, UK.
Over the years he has dedicated a lot of time to helping new developers, becoming a well known moderator at Team Treehouse