I’m moving an old EE-install to a new server. I’ve set the server to PHP 5.6, but don’t know what the old server was running (don’t have access).
The app_version is 261.
I’ve set debug to 2 and get the following error when navigating to the home URL or control panel:
A Database Error Occurred Unable to connect to your database server using the provided settings. Filename: core/EE_Config.php Line Number: 207
The line number it refers to is this:
$query = ee()->db->get_where('sites', array('site_id' => $site_id));
When using the dbtest.php all is fine:
A connection was established to your database server Your database was selected.
Where should I look to try to resolve this?
Mmmm- you may want to try it using mysqli -
$db[‘expressionengine’][‘dbdriver’] = ‘mysqli’;
And if that doesn’t work, either check php error logs or check in either system/codeigniter/system/database/drivers/mysql/mysql_driver.php or mysqli/mysqli_driver.php - find the function db_connect() and go remove the error suppression where it tries to connect. Hopefully that gets you a better error.
return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); change to return mysql_connect($this->hostname, $this->username, $this->password, TRUE);
Changing the dbdriver to mysqli didn’t change anything visibly.
However, when changing the code in the mysqldriver as you instructed, I got three extra error notifications, of which one referred to being unable to connect with a username that was not the correct one. So I searched the entire project folder for that username and I found one result in a config_bootstrap.php file in the public folder. This file contains database settings for different environments and somehow the values in the database.config file were overwritten by these. I changed the settings there and set debug back to 1 and now everything seems to work.
Awesome Robin, thank you so much!
Nice- thanks for letting us know how it turned out!
Sounds like they were using Master Config. If you go to the very bottom of your config.php they’re probably including it there- it will then override any setting above it- if it’s set in master config.
I’m not a huge fan of it when upgrading and will often remove it before I upgrade. But sounds like you got it done regardless!