Wordpress and MySQLi Only Installs
I have long since ditched MySQL 4, and about a year ago I stopped installing the plain MySQL libraries with PHP. (Mostly, they are a pain to install when you are custom building MySQL 5 and PHP 5 on 64 bit architecture, but I digress…)
However, not having access to the plain mysql_* functions makes Wordpress very sad. In WP2.3 there was a work around that was pretty painful, involving some core editing. However, between then and WP2.5, the meek sobbing of folk like myself have been heard!
Simply download this updated db.php and place it in at wp-content/db.php.
You’re done. No really. That’s it! From what I can tell this should even work for fresh installs, not just current installs. If you find anything broken with it, let me know and I’ll give it an update.
Update! I’ve updated to work with Wordpress 2.8.4. You can get the new db.php file here: http://jrm.cc/extras/wp-mysqli-2.8-db.txt
Hello Jeff,
sorry for off topic. I have write two mails over your contact-mail and not became a answer.
I have write a new version of your very nice plugin Text Control. Works now also with wordpress 2.3 and 2.5 and 2.6beta. You can download this zip an http://bueltge.de/wp-content/download/wp/text-control.zip
I hope you enjoy this. When you like this version, please upload the new version to the SVn of wordpress.org. Many people use your nice plugin.
With best regards and sorry for my bad english
Frank
AMEN brother ! I just came across this post. I’m still wondering why the core developers won’t completely clean up db funcs for mysqli library and Mysql 5.x++ — for that matter, they still haven’t officially declared victory over anything beyond php 4.x, there are still plenty of lingering gotcha’s with that – but it’s listed as compat — alas i’ve digressed —
i’ve certainly made a huge stink about the mysqli libs, php5 and some issues with charsets/data collations at every available opportunity, too bad some folks are so smart… they know everything, so they can’t learn much from a grumpy old bastard like me…
why would an in vogue webX.X OPEN SOURCE proj. like WP want to use anything like a modern version of DB and prog. language anyways ?
I’m not bothered so much by the fact that they support MySQL old, but it’s bugs me much more that it doesn’t support current standards :(
right on there as well, it’s fine to be backwards compatible, but an entirely other situation to not support fully the current ‘real world’ standard.
this is mostly just core devs being lazy and stubborn, i’d certainly concede some of the new ‘window dressing’ type features for ‘new’ compatibility. i’ve seen/worked with a number of OS projects where Goal #1 is keeping FULL backwards compatibility with at least the previous release AND staying current/on top of things with complete ‘new’ compatibility as well. requested user features and the like come second.
A Postscript:
It’s also interesting to note (off the topic though) that even though in theory an open source project with a reasonably active community should be very nimble and able to produce these types of compatibility upgrades much faster and without ANY of the constrains that go along with being a commercial entity – ie. MSFT, IBM, ORCL, etc. It’s at least understandable why compatibility with certain things takes them a while sometimes.
@Jeff: do you have read my comment #1? Please give me a answer.
Ah, I have no access to that SVN anymore. Forgot the password, lost the original email account, and wordpress support has failed to respond to me THREE times now about the issue (which is such a simple fix…)
I’d love to fix it — if I could.
Thanks for your answer – i look for a other possibility to change the files in SVN.
Best wishes and thx
i’m guessing you’re aware of the current plugin contribution procedures ?
Just tried this with 2.6 and it seems to work OK.
Thanks a lot….I’d spent a few hours on the WP forum reading the largely useless comments to this problem.
I’m having some problems where the content of my entries is having any carriage return line feeds converted to eg “rnrn”. I haven’t had this on any other sites, where I don’t use your routines. Is this connected? I seem to have to edit my posts in html mode to make them work.
Any thoughts?
Ian,
As it turns out, this site is running on 2.6 with the mysqli install I gave out above and I don’t seem to have that problem.
Not much help, I know, but at least it’s not as likely to be the cause and that’s a step closer.
Frank, thank you so much for updating Jeff’s text control plugin for new versions of WP — it’s indispensible!
@Blake K: Welcome. Sadly it is not poosible to upload to wordpress.org.
Unfortunately it doesn’t seem to work with the latest Wordpress (2.8.4), I’m getting the error:
Fatal error: Call to undefined method wpdb::has_cap() in /path/to/wordpress/wp-admin/includes/schema.php on line 22
When I run wp-admin/install.php
Bam! Just updated it and now it’s working with 2.8.4 series.
http://jrm.cc/wp-content/db.txt
In fact, this update is even a little bit more resistant to future additions like that. But prolly not.
Great!
Thanks very much!
Dave
Me again – the file seems to have disappeared. Any chance of making it available again?
My Wordpress installation seems to have broken itself somehow, despite working fine yesterday and not being upgraded (unless it upgraded itself automagically). I was just getting a blank page, but after manually tracing the problem back through about 10 functions/includes I found it was the following line in the db.php file:
ln341 $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
After finding this line was causing the problem, I removed the error suppression from it and now get the error
Fatal error: Call to undefined function mysql_connect() in /home/djeyewater/webapps/htdocs/photosite/blog/wp-content/db.php on line 341
So I’m guessing my db.php has somehow got messed up (since mysql_connect() isn’t a mysqli function) and I’d like to download your mysqli version again.
Thanks
Dave
It’s back. Be warned, however, I won’t be updating this anymore. My host now comes with mysql/mysqli, so I won’t be scratching the itch, so to speak.
Thanks again!
Dave
Well, for those of you looking for the 2.9 version: http://www.rdlt.com/wordpress-mysqli-2-9-database-class-patch.html
works on 2.9.2
This breaks comments for me:
http://www.rdlt.com/wordpress-mysqli-2-9-database-class-patch.html