I've tried to upgrade an existing PHP 5.2.x site running WordPress to PHP 5.4 by editing my .htaccess file. Unfortunately this immediately results in the dreaded

Error establishing a database connection

WordPress error.

Has anyone else experienced this? I have multiple WordPress installs and it happens on all of them. Why would upgrading the PHP version have any effect on the DB connection?

asked 15 Mar '12, 20:51

ehough's gravatar image

accept rate: 0%

Some other PHP applications we have seen are unable to access the database after an upgrade to PHP 5.4, and have a specific error similar to the following:

cannot connect to MySQL 4.1+ using the old insecure authentication.
Please use an administration tool to reset your password with the command
SET PASSWORD = PASSWORD('your_existing_password'). This will store a new,
and more secure, hash value in mysql.user.

In order to rule out this possibility, try setting your password for your database again in the WebFaction Control Panel. This should perform the "SET PASSWORD" command as described above.

permanent link

answered 16 Mar '12, 01:26

ryans's gravatar image

ryans ♦♦
accept rate: 42%

OK, I just added

< FilesMatch .php$>
    SetHandler php54-cgi
< /FilesMatch>

to my .htaccess file to prep for the support ticket and lo and behold - it works. The only difference was, this time I just used vim to edit the file. Wherease before I was using this plugin to manage changes to .htaccess.

Who knows. I'm just happy that it's working! Thanks your input and hope I didn't waste too much of your time.

permanent link

answered 15 Mar '12, 23:25

ehough's gravatar image

accept rate: 0%

Glad to hear you found the source of the problem.

(15 Mar '12, 23:32) johns ♦♦ johns's gravatar image

I spoke too soon! Was looking at a cached version of that page. The good news is that simply resetting the DB password from my control panel works fine. Onwards..

(16 Mar '12, 10:26) ehough ehough's gravatar image

Please submit a support ticket so we could look at the server and the account directly, you should not have a database error for simply upgrading.

permanent link

answered 15 Mar '12, 22:18

johns's gravatar image

johns ♦♦
accept rate: 23%

You might also want to try resetting your database password with what is set in the wp-config.php file just to be 100% sure it is correct.

(15 Mar '12, 22:50) johns ♦♦ johns's gravatar image

PHP 5.4 changed to mysqlnd (native driver) instead of libmysql, therefore OLD mysql (pre mysql 4.1) passwords are not supported with mysqlnd, simply change your db password as solution, make sure your mysql installation does not enforce old-style passwords (phpmyadmin passwd change function will let you choose which password style to use old or new)

permanent link

answered 21 Aug '12, 21:24

Lulu's gravatar image

accept rate: 0%

edited 21 Aug '12, 21:26

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 15 Mar '12, 20:51

question was seen: 10,808 times

last updated: 21 Aug '12, 21:26

Features & prices    Sign up    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
© Copyright 2003-2015 Swarma Limited - WebFaction is a service of Swarma Limited