Hello

I have Drupal 4.5.0 installed on my local Windows XP machine (SP2). I'm running MySQL 4.1.7, PHP 5.0.2 and Apache 2.0.48.

Drupal 4.5.0 used run perfectly with same setup, except I had MySQL 4.0.17 installed.
However, when I installed MySQL 4.1.7, Drupal stopped working, as the mysql_ extention doesn't work with MySQL 4.1x databases anymore. You have to use the mysqli_ extensions.

So I set off patching my own Drupal and modified it so that all the mysql_ function names get's renamed to mysqli_. With the new mysqli_ extension, parameters are passed in a different order, and in some rare cases, new parameters needed to be passed. This I also fixed.

The Drupal running on my computer is only a devel machine, for writing modules. The week that I tested this new code, I didn't get any errors reported in my Apache error log. So I'm sure that it is somewhat stable enough ;)

However, this patch is not the be-all-end-all. There is one major problem with it. It changes Drupal in such a way that it makes it incompatible with MySQL 4.0.x systems (running php 5).
So I suggest not to commit this patch, but to only look at it.

What would really be nice would be to get the database version from Drupal (ie: 4.0.x vs 4.1.x), and then do an "if" on it.

Ex:
if (mysql_version == mysql4_0) {
mysql_functioname(...);
}
else {
mysqli_functionname(...);
}
Then everywhere where the code needs to do a MySQL call (in include/database.mysql.inc), you place it in an "if (mysql_version == mysql4_0) {" block. I agree, it's probably not the best way to do it.

Hope it helps. Mail me if you have any questions/queries/commentc etc..

Willie

CommentFileSizeAuthor
mydiff.txt5.93 KBAnonymous (not verified)

Comments

gábor hojtsy’s picture

There is absolutely no need to change the mysql extension to mysqli for MySQL 4.1+, only the connection password needs to be set with OLD_PASSWORD(). I guess you hit the Client does not support authentication protocol requested by server; consider upgrading MySQL client error, you beleived in it...

Drupal needs to have instructions for MySQL 4.1+. See the mailing list for the thread I have started.

dries’s picture

This patch can't be applied without breaking older systems. Marking this 'active' instead.

qube’s picture

Version: » 4.6.0

I run MySQL version 4.1.10 and PHP 4.3.10 on my devel machine and several php sites (including Drupal 4.6.0) have problem with special accented characters. Everything afer the accented character including that character is deleted.

Sometimes it goes well, sometimes it does not. For example when running cron, the search_index table gets a lot of duplicates, beacouse words are truncated and thus causing duplicity.

This one of many similar errors I get running cron:

user error: Duplicate entry 'liber' for key 1
query: INSERT INTO drupal_search_total (word, count) VALUES ('liber�ln�', 0) in D:\www\bv\includes\database.mysql.inc on line 66.

But inserting node with accented characters seems fine. So far I don't know what are the exact conditions when this happen.

I'm not sure, whether this problem exists in 4.5.0, beacouse I didn't played so much with 4.5.0 on my devel machine.

I use utf8 encoding for database and collation utf8_general_ci (I tried also other collations but without success).

qube’s picture

The conclusion from my previous post is that there are maybe more issues regarding MySQL 4.1 and mysql PHP extension then just old style password.

killes@www.drop.org’s picture

Project: Drupal core » Documentation
Component: database system » Admin Guide
Category: bug » task

There is no need to change anything according to Goba, but it shoudl be documented. Moving

qube: You need to check the encoding setting for your database.

sepeck’s picture

already documented in the FAQ

sepeck’s picture

Status: Active » Closed (fixed)