Newsletter "Behind the Scenes" Newsletter

January 2016The monthly newsletter by Felgall Pty Ltd

My Word


December saw the release of PHP 7 which is the first major PHP release since 2004 when PHP 5 was released (PHP 6 was abandoned as it tried to change something that turned out to be too hard to do at the time and all of the worthwhile parts of what had been developed for PHP 6 made their way into PHP 5.3 and PHP 5.4).

One change that will have a big impact on use of PHP 7 is that it has finally dropped support for the antiquated mysql_ calls that PHP 4 and earlier provided as the only way to interact with a mySQL database. Despite all of the advanced warning there are still a lot of people asking for help with PHP code that includes these calls where they have not even now started to convert them to use one of the alternatives.

When PHP 5 was released in July 2004 it introduced a replacement for the mysql_ calls using mysqli_ calls instead. The 'i' indicated that the interface was 'improved' (which it is). These calls were not direct plugin replacements for the old calls so it wasn't just a matter of adding an 'i' into the code. The order of the parameters was changed, the database connection became required. Some of the poorer calls had no equivalent at all. An object oriented version of all the calls was introduced. New calls were also introduced to provide new advanced features.

Within weeks another new interface called PDO was also introduced. This one was the equivalent to the object oriented version of the mysqli_ interface with even more features and support for other database systems as well as mySQL.

So these two improved interfaces have now been around for over eleven years and professionals will have switched to using them for new projects soon after their introduction. Of course they would have needed to continue using the old interface for existing projects until such time as the owner of those projects was prepared to pay for the upgrade.

One advanced feature that both of the new interfaces provided is the ability to 'prepare' an sql command using placeholders for where the values are to be substituted so that the sql can be run multiple times more efficiently because the database engine knows in advance what data to access and is just waiting to find out the specific values to look for in that data which is provided via a separate database call that can be run multiple times for a single prepare. Both interfaces support ? as a placeholder in the prepare statement while PDO also allows named placeholders. As an added benefit this approach keeps the code and data completely separate making 'escaping' the data completely unnecessary.

If the new benefits were not enough to convince owners that they should get their code upgraded then they got another reason presented to them when PHP 5.5 was released in mid 2013. That version 'deprecated' the old mysql_ interface. For those of you who don't know what deprecated means in programming terms, it means that the old interface was now considered to be obsolete and that it would be removed completely at some future time. All professional programmers would have used this as a reason to propose upgrading the older code to use one of the newer interfaces that by this point had been around for about nine years (and which had therefore proved themselves to be stable). The second half of the deprecation of the mysql_ interface was implemented in PHP 7 with the complete removal of the interface from that version. PHP 7 only supports the two newer interfaces implemented eleven years previous.

All the amateurs who had ignored the deprecation notice and continued to use the old interface now need to fix their code before they can upgrade to the new PHP 7. Effectively this gives them eighteen months to make the change (which they could have made at any time in the past eleven years but didn't). There are three versions of PHP that are currently supported - PHP 7 which has just been introduced, PHP 5.6 which has full support until July and then a further twelve months of security patch support an d PHP 5.5 which still has security patch support until July. So in eighteen months time there will no longer be any version of PHP that supports mysql_ calls that has any support at all. Of course many amateurs will disregard this and will still be running mysql_ code on unsupported versions of PHP for some time after that. It will probably come down to when the web hosts they are using get fed up with all the security issues of no longer supported versions of PHP and decide to not offer them any more. At that point there will probably be a lot of web sites that will be completely broken for some months until their owners can get the code rewritten. As not all web hosts will enforce the upgrade at the same time these broken amateur sites will probably appear every so often for a couple of years until all of the hosts have forced PHP 7 as the minimum version they support.

On Site

A bit more variety in the articles is finally starting to appear. The changes to PHP with version 7 have given me a few ideas for new PHP and mySQL articles that I can write so you should see more pages on these topics appear in the next few months. I am also starting to get more requests for reviewing software so you should also see some more reviews soon.

What's New

The following links will take you to all of the various pages that have been added to the site or undergone major changes in the last month.

Main Links

Ask Felgall
Past Newsletters
Sign Up/Unsubscribe
Question Forum


Interactive Web
PC Software
Comms Software
Word Processing
Book Reviews

Other Links

My Javascript Site
My Blog