Title: upgrading to php 5.3 &#8211; &quot;database connection failed&quot;
Last modified: August 31, 2016

---

# upgrading to php 5.3 – "database connection failed"

 *  Resolved [pigsound](https://wordpress.org/support/users/pigsound/)
 * (@pigsound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/)
 * in order to secure the functionality of one plugin that requires php 5.3, i tried
   to change the php accordingly.
    my host provides instruction on how to do it:
 * >  On our servers the following php versions are running:
   >  – PHP 4.4.9 [.php4]–
   > PHP 5.2.17 [.php5] – PHP 5.3.6 [php53]
   > with the respective suffixes the according php version is used as parser.
   >  
   > to use a special php version for all files with .php suffix you can create 
   > a .htaccess files with the following content:
   > # List of file suffixes to use with php5
   >  AddHandler php-fastcgi5 .php
   > or
   > # List of file suffixes to use with php4
   >  AddHandler php-fastcgi4 .php
   > or
   > # List of file suffixes to use with php3
   >  AddHandler php-fastcgi5.3 .php
 * since there already exists a .htaccess file in my wordpress installation, i was
   not sure where to add these lines (the one for php 5). so in my first try i put
   it right before everything that already existed in the .htaccess file.
    this 
   caused wordpress to show a blank page with the message “database connection failed”.
   then i put the lines right after everything that already was written in the .
   htacces file with the same result.
 * does anybody have an idea what i can do to upgrade my php version? did i do it
   wrong?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [staartmees](https://wordpress.org/support/users/staartmees/)
 * (@staartmees)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428593)
 * All those php versions are end of life or no longer supported. Minimal php version
   is 5.6, [http://php.net/supported-versions.php](http://php.net/supported-versions.php)
 *  Thread Starter [pigsound](https://wordpress.org/support/users/pigsound/)
 * (@pigsound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428695)
 * thank you for that detail, according to it i changed the htaccess file to:
 * >  AddHandler php-fastcgi5.6 .php .phtml .phps
   >  <IfModule mod_rewrite.c> RewriteEngine
   > On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}!-
   > d RewriteRule . /index.php [L] </IfModule>
 * again the database connection failed. what is wrong here?
 * thank you for your help, hints and advice in advance!
 *  [Barry](https://wordpress.org/support/users/barryhughes-1/)
 * (@barryhughes-1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428697)
 * If you enable WP_DEBUG [(see here to learn how)](http://codex.wordpress.org/WP_DEBUG)
   do you see any additional error messages?
 *  Thread Starter [pigsound](https://wordpress.org/support/users/pigsound/)
 * (@pigsound)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428703)
 * turning wp-debug mode on causes wordpress to show nothing more but the following
   message:
 * >  Can’t select database
   >  We were able to connect to the database server (which means your username 
   > and password is okay) but not able to select the ladanroxy.com database.
   >  * Are you sure it exists?
   >  * Does the user xxxxxxx have permission to use 
   > the ladanroxy.com database? * On some systems the name of your database is 
   > prefixed with your username, so it would be like username_xxxxxx. Could that
   > be the problem?
   >  If you don’t know how to setup a database you should contact your host. If
   > all else fails you may find help at the WordPress Support Forums.
 * since the wordpress site works as long as i don’t use the modified htaccess file,
   database, permission and prefix must be ok. very strange, at least to me… anybody?
 *  [Barry](https://wordpress.org/support/users/barryhughes-1/)
 * (@barryhughes-1)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428711)
 * That does sound strange. Might be worth connecting with your host and asking 
   for their input.
 *  Thread Starter [pigsound](https://wordpress.org/support/users/pigsound/)
 * (@pigsound)
 * [10 years ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428772)
 * problem solved:
    the database password has to be changed. first, i changed it
   in the database via myphp or cpanel, then i changed it in wp-config.php. then,
   i changed the htacces as follows:
 *     ```
       AddHandler php-fastcgi5.6 .php .phtml .phps
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
       ```
   
 * now the website runs just like before and php is upgraded to 5.6!
    🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘upgrading to php 5.3 – "database connection failed"’ is closed to new
replies.

## Tags

 * [database connection](https://wordpress.org/support/topic-tag/database-connection/)
 * [htaccess](https://wordpress.org/support/topic-tag/htaccess/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 3 participants
 * Last reply from: [pigsound](https://wordpress.org/support/users/pigsound/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/upgrading-to-php-53-database-connection-failed/#post-7428772)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
