There’s been a lot of talk lately that PHP is dumping the mysql extension from its core, and how that move will impact major Content Management Systems such as Joomla, WordPres, and Drupal.
First, let us explain, briefly, what this is all about…
PHP, in its current incarnation, has several built-in extensions (or libraries) that it can use to talk to a MySQL database. These extensions include, but are not limited to: mysql (ext/mysql), mysqli (ext/mysqli), and pdo_mysql (ext/mysql_pdo). All these libraries do the job, but the mysql (ext/mysql) library is the least performing of the bunch, it is also very insecure. See, the problem with this library is that it was written ages ago in PHP 4 to support MySQL 3, so it inherited the limitations (and insecurity) of both. In this day and age, when there are very few servers running PHP 4, and even fewer running MySQL 3 (actually there shouldn’t be any server on this planet running MySQL 3, but you never know), the use of this library is no longer necessary (note that Joomla needs at least PHP 5 and MySQL 5 to work), in fact, it is discouraged, and that’s why PHP deprecated the mysql extension in its 5.5 version (by the way, when an extension is deprecated, it still works, but any use of any function belonging to that extension will throw a deprecated notice).
PHP intends to remove its support of the mysql legacy library (access to the MySQL database will still be supported by the other libraries, of course) in the next few years. Unfortunately, this is not an easy move, because this move means that any PHP function that starts with mysql_ will throw a fatal error. Naturally, this will cause many websites out there to stop working. In fact, every single WordPress website will cease to work because WordPress still uses that old extension.
But what about Joomla?
The Joomla team thankfully did the right thing with the early adoption of the mysqli extension. In fact, Joomla uses the mysqli extension, by default, for all MySQL activities. This means that Joomla’s core will not be affected at all by PHP’s move to remove the legacy extension (unless, of course, you have forced the use of the mysql extension by going to Site -> Global Configuration -> Server and changing the value of Database Type under Database Settings to mysql) . However, there are some Joomla extensions that either access the database directly or through their own database layer – such extensions may be using the old mysql library. If this is the case, then these extensions need to be modified to use the mysqli extension.
And what about WordPress?
It seems that WordPress will start supporting the mysqli extension in its 3.9 version, in conjunction with the the old mysql extension. It is not clear on whether WordPress will use the mysqli library by default in its installation, but at least this is a move in the right direction.
And how about Drupal?
Drupal is very similar to Joomla in that regards. It currently supports both extensions and defaults to the mysqli extension.
Is that PHP move really necessary?
Unfortunately – it is – for both PHP and MySQL… MySQL is forced to preserve some legacy code for that library (or extension) to work, and that legacy code is causing some serious overhead for MySQL’s developers. This is more or less the same for PHP, which has to maintain an extension that should no longer be used.
We hope that this post clarified the issue. If you have a Joomla extension that is using the mysql extension, then fear not, we can modify the extension to make it work with the mysqli extension. All you need to do is to contact us and we’ll fix it in no time and at a very low cost!