X

The leading edge of scripting languages and Oracle Database brought to you by the Data Access Development team

  • php
    November 26, 2012

How (and when) to move users to mysqli and PDO_MYSQL?

Christopher Jones
Senior Principal Product Manager

An important discussion on the PHP "internals" development mailing list is taking place. It's one that you should take some note of. It concerns the next step in transitioning PHP applications away from the very old mysql extension and towards adopting the much better mysqli extension or PDO_MYSQL driver for PDO. This would allow the mysql extension to, at some as-yet undetermined time in the future, be removed. Both mysqli and PDO_MYSQL have been around for many years, and have various advantages: http://php.net/manual/en/mysqlinfo.api.choosing.php

The initial RFC for this next step is at https://wiki.php.net/rfc/mysql_deprecation I would expect the RFC to change substantially based on current discussion. The crux of that discussion is the timing of the next step of deprecation. There is also discussion of the carrot approach (showing users the benfits of moving), and stick approach (displaying warnings when the mysql extension is used). As always, there is a lot of guesswork going on as to what MySQL APIs are in current use by PHP applications, how those applications are deployed, and what their upgrade cycle is. This is where you can add your weight to the discussion - and also help by spreading the word to move to mysqli or PDO_MYSQL. An example of such a 'carrot' is the excellent summary at Ulf Wendel's blog: http://blog.ulf-wendel.de/2012/php-mysql-why-to-upgrade-extmysql/

I want to repeat that no time frame for the eventual removal of the mysql extension is set. I expect it to be some years away.

Join the discussion

Comments ( 4 )
  • Stelian Mocanita Monday, November 26, 2012

    I don't think it's a matter of migrating the users, rather than the companies. There is a lot of legacy code out there that just doesn't get assigned the right priority to be refactored, or it is simply not being updated on the premises that it's working as intended and development is no longer needed on it (e.g Internal tools).

    On the user side, I am confident that new projects starting now are in fact using the newer extensions and that everyone understands that at some point the old one will just have to go.

  • Chris Jones Tuesday, November 27, 2012

    One of the discussion points has been whether such legacy sites are even updating PHP (which they should, for security & stability reasons) and hence whether any deprecation efforts will even be noticed.

  • Matt @ Firebox Wednesday, November 28, 2012

    carrot approach is the way to go, much higher volume of quick adoption that way I think... Gotta show the goods slowly to give time to transition and embrace

  • Christopher Jones Wednesday, November 28, 2012

    The mysqli extension has been around since 2003/2004. Is that enough carrot?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.