Forum Moderators: coopster

Message Too Old, No Replies

PHP 5.3.1, mysqlnd and WordPress database connection problem

         

encyclo

12:28 am on Dec 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to run identical code (unaltered WordPress) on two different servers - both the same OS (FreeBSD 7.2), the only significant difference being PHP 5.2.12 on one machine, 5.3.1 with mysqlnd support on the other. I get an error "Error establishing a database connection" in the 5.3.1 environment. Both times I'm connecting to the same MySQL database server (on a different machine).

I'm aware that the 5.3.x branch has some significant changes, the "mysqlnd" being one. Could this be the reason why WordPress can't connect to the database? Note that MySQL is not running on the server where the files are stored, so I'm guessing mysqlnd might well be the culprit here.

coopster

12:54 am on Dec 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, likely it is. Rather the API using mysqlnd. I ran into similar issues on 5.3 earlier this year. There are some bugs in the pre-init (mysql_options) functions, if you are running any. Upgrade to latest stable version and if that doesn't resolve it, try the latest svn (snaps) release.

Otherwise, you said MySQL is not running on the server where the files are stored ... meaning remote connection? If so, you may have other problems.

encyclo

1:33 am on Dec 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The MySQL database server is on the same internal network as the Apache servers in a load-balanced environment, so it's not a remote connection as such. I'm trying to see what breaks if I upgrade :) I think I need to better understand mysqlnd and its role here (I'm far from being a PHP or MySQL expert).

The error logs point to an authentication issue, similar the one described here:

[dev.mysql.com...]

I'm still unclear however on how to solve the problem without in turn risking breaking things in the PHP 5.2 environment.

coopster

12:11 pm on Dec 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That's just MySQL though. If you have upgraded MySQL you may need to run the update application [dev.mysql.com]. And I'm thinking you are well beyond that point already.

I notice I said mysql rather than mysqli (options) in my first message. It's all I use now. I did not run into any mysqlnd issues when I converted except for a bug in the mysqli_options [webmasterworld.com] on my 5.3 box [webmasterworld.com]. But that was because I was using mysql_options to pre-init the server upon database abstraction class instance.

coopster

12:34 pm on Dec 31, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm trying to find any documentation I can on the The MySQL Native Driver [webmasterworld.com]. I know I did some extensive testing and research when I converted some of my systems. There were some requirements [php.net] that I confirmed and after that it was conversion to the mysqli API and all went well. I tested the mysqli API on 5.2 and then with the native driver in 5.3 to compare performance.

Are you connecting with the mysql API or the mysqli API?