WordPress.org

Ready to get started?Download WordPress

Forums

I've changed WordPress 2.0.5 to use mysqli instead of mysql (8 posts)

  1. mike503
    Member
    Posted 7 years ago #

    mysqli is an improved extension, I prefer it on all my projects. I was surprised to see WordPress didn't use some bundled database abstraction layer; although those typically create more overhead, with such a large userbase I thought it would be in there. Oh well.

    It wasn't very difficult, and seems to work 100% so far.

    I haven't really created patches in the past, but here it is - apply using "patch -p0 -u < wordpress-2.0.5-mysqli.patch" in the root wordpress directory.

    Here's the patch: http://michaelshadle.com/projects/wordpress/wordpress-2.0.5-mysqli.patch

    Any comments feel free to share here:
    http://michaelshadle.com/2006/12/29/quick-hack-mysqli-support-for-wordpress-205/

  2. Don't edit wp-db.php. Instead, name the file db.php and stick it in your wp-contents folder. WordPress will automatically use it instead of the default one. ;)

  3. mike503
    Member
    Posted 7 years ago #

    that doesn't seem to work for me (?)

    i also grepped the source and see no reference to testing for the existence of a db.php file ...

  4. Kafkaesqui

    Posted 7 years ago #

    Viper, your suggestion will only work with the next major update to WordPress (currently referred to as 2.1).

    Mike, if you want the *feature* Viper mentioned, you can modify your wp-settings.php so that the following line in it:

    require_once (ABSPATH . WPINC . '/wp-db.php');

    is instead:

    if ( file_exists(ABSPATH . 'wp-content/db.php') )
    require (ABSPATH . 'wp-content/db.php');
    else
    require_once (ABSPATH . WPINC . '/wp-db.php');

  5. mike503
    Member
    Posted 7 years ago #

    why not just throw in an actual database abstraction layer, or mysqli support in the distribution? :)

  6. kosso
    Member
    Posted 7 years ago #

    I must agree. Lack of mysqli support in WordPress is the one thing hindering/stopping me installing my own WordPress.

    I have tried a few times to fix this, but can never get it all working.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    What is the advantage of using the mysqli extension? I'm not seeing any, except that:
    a) it requires a certain version of MySQL,
    b) it requires that your PHP have support for it (which is not there by default)

    It doesn't change the actual end result, so what's the point?

  8. mike503
    Member
    Posted 7 years ago #

    When it was first introduced, it was claimed to be better all around. Of course, I am seeing mixed opinions about that. It most definitely has more features including prepared statements (which can speed up redundant/paramaterized queries) and can prep the input data appropriately and safely. It also uses the newer MySQL authentication API it appears (which I think use stronger encryption for passwords.)

Topic Closed

This topic has been closed to new replies.

About this Topic