Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Davey Shafik:
PHP 7 ext/mysql Shim
Dec 07, 2015 @ 17:10:24

With the release of PHP 7 comes a major shift in how your programs may interact with databases - the removal of the mysql extension (in favor of mysqli or PDO). Depending on how your application is written, this can cause all sorts of headaches. Davey Shafik has offered a temporary solution in a post to his site today, a mysql shim library that can be used to mimic the older mysql functions until you can upgrade your application.

To help ease the transition from 5.6 to 7.0 I have created a simple package that acts as a shim between the newly removed ext/mysql and ext/mysqli. I was a little hesitant to even publish this as I don’t want to encourage the continued use of potentially insecure code, however, I want people to upgrade to 7.0 and don’t want this to be the blocker.

It does require 5.6 (though it would be possible to lower that) — however I suspect that most people who are upgrading to 7.0 are either coming from 5.6 or have the native ext/mysql. The primary reason for support 5.6 is to be able to compare the test suite results against native ext/mysql.

The library can be easily installed via Composer and, while useful in its current form, still has some work yet to be done on it to bring it up to fully compatible. If you'd like to help on the effort and make life a little easier for those upgrading to PHP 7 on older code, head over to the repository and think about contributing.

tagged: mysql extension php7 shim library backport upgrade

Link: https://daveyshafik.com/archives/69726-php-7-extmysql-shim.html


Trending Topics: