MySQLi for WordPress 2.1.x

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.


MySQLi for WordPress 1.0

  1. It’s been available for years, just no one uses it. 

  • Similar Posts

    Craving more? Here are some posts a vector similarity search turns up as being relevant or similar from our catalog you might also enjoy.
    1. File-Based Extension to the WordPress Object Cache
    2. WordPress, PerformancePress, and GSoC 2008
    3. XCache and eAccelerator Plugins for WordPress
    4. WordPress 2.5 and the Object Cache...
    5. Getting WordPress Super Cache to Run on a Windows (IIS or Apache) Server
  • 2 thoughts on “MySQLi for WordPress 2.1.x

    Leave a Reply

    Your email address will not be published. Required fields are marked *