MySQLi is a “new”1 and improved version of the original MySQL extension for PHP. While there is no especially convincing reason to switch from the original MySQL functions to MySQLi, both MySQL and PHP recommend that developers do so.
WordPress is aimed for the masses and WordPress 2.0 still supports even MySQL 3.x – so most likely we won’t be seeing a switch to a MySQLi-powered WordPress anytime soon. However, for those that care about such things, we’ve created a MySQLi conversion file for WordPress.
If you’re host refuses to enable the MySQL functions for PHP and instead requires that you use the new MySQLi extension, then this is for you. If you’re your own host, make sure that MySQLi is enabled on your server before you continue by uncommenting the mysqli extension in php.ini:
In our testing, MySQLi processed queries and page loads at around a couple of microseconds slower or faster than the normal MySQL functions depending on the queries being issued and the current load on the server (MySQLi seems to perform better under heavy CPU load than MySQL). MySQLi is more reliable under times of PHP load, but isn’t any faster or better performing as far as MySQL is concerned.
Refer to the readme file contained in the zip download for more information, but in short, extract our db.php to the /wp-content/ directory of your WordPress install. This isn’t a plugin per-say, so don’t stick it in the /wp-content/plugins directory by accident – it won’t work if you put it there.
While this plugin is not officially supported on WordPress 2.0.x, you can force it to work by replacing /wp-includes/wp-db.php with db.php from the zip file below.
This file is mainly composed of MySQLi code taken from bbPress with some changes. As such, it’s licensed under the GPL.
It’s been available for years, just no one uses it. ↩
Many thanks guys, I’m installing this now.
Commenting closed. For some odd reason, this post alone attracts more spam than the rest of the blog put together.
If you need help with this plugin, please open a thread at http://neosmart.net/forums/ and we’ll help you out.