I have upgraded a client’s website from EE2 to EE6 and everything is working on PHP 5.6, but when I change the PHP to PHP 7.4 it breaks. When I try to log in to the control panel, I get this error message, on both admin.php and index.php:
Exception Caught There was a database connection error or a problem with a query. Log in as a super admin or enable debugging for more information. mysqli_connection.php:114
There is no way for the database connection details to be wrong, because I am literally just changing the PHP version. None of the code changes.
Does anyone have any ideas? Any help would be greatly appreciated : )
These are the server details:
Database server Server: Localhost via UNIX socket Server type: MySQL Server connection: SSL is not being used Documentation Server version: 5.7.43-cll-lve - MySQL Community Server - (GPL) Protocol version: 10 User: cpses_f80zyamxwh@localhost Server charset: cp1252 West European (latin1) Web server cpsrvd 220.127.116.11 Database client version: libmysql - mysqlnd 7.4.33 PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation PHP version: 7.4.33
@Robin Sewell… this is the error output:
Exception Caught SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ino_db_new.exp_cookie_settings' doesn't exist: SELECT CookieSetting_cookie_settings.cookie_id as CookieSetting__cookie_id, CookieSetting_cookie_settings.cookie_provider as CookieSetting__cookie_provider, CookieSetting_cookie_settings.cookie_name as CookieSetting__cookie_name FROM (`exp_cookie_settings` as CookieSetting_cookie_settings) WHERE ( `CookieSetting_cookie_settings`.`cookie_provider` IN ('ee', 'cp') ) LIMIT 18446744073709551615 ee/legacy/database/drivers/mysqli/mysqli_connection.php:114 Stack Trace: Please include when reporting this error #0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('SELECT CookieSe...') #1 ee/legacy/database/DB_driver.php(260): CI_DB_mysqli_driver->_execute('SELECT CookieSe...') #2 ee/legacy/database/DB_driver.php(175): CI_DB_driver->simple_query('SELECT CookieSe...') #3 ee/legacy/database/DB_active_rec.php(1083): CI_DB_driver->query('SELECT CookieSe...') #4 ee/ExpressionEngine/Service/Model/Query/Select.php(51): CI_DB_active_record->get() #5 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Select->run() #6 ee/ExpressionEngine/Service/Model/DataStore.php(220): ExpressionEngine\Service\Model\DataStore->runQuery('Select', Object(ExpressionEngine\Service\Model\Query\Builder)) #7 ee/ExpressionEngine/Service/Model/Query/Builder.php(150): ExpressionEngine\Service\Model\DataStore->selectQuery(Object(ExpressionEngine\Service\Model\Query\Builder)) #8 ee/ExpressionEngine/Service/Model/Query/Builder.php(63): ExpressionEngine\Service\Model\Query\Builder->fetch(false) #9 ee/ExpressionEngine/Core/Provider.php(368): ExpressionEngine\Service\Model\Query\Builder->all() #10 ee/legacy/libraries/Core.php(139): ExpressionEngine\Core\Provider->registerCookiesSettings() #11 ee/legacy/core/Controller.php(65): EE_Core->bootstrap() #12 ee/legacy/core/Controller.php(76): Base_Controller->__construct() #13 ee/legacy/core/Controller.php(102): EE_Controller->__construct() #14 ee/ExpressionEngine/Core/Core.php(255): CP_Controller->__construct() #15 ee/ExpressionEngine/Core/Core.php(122): ExpressionEngine\Core\Core->runController(Array) #16 ee/ExpressionEngine/Boot/boot.php(161): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request)) #17 admin.php(153): require_once('...') #17 admin.php(153): require_once('...')
You can tell it’s Friday based on the fact nothing makes any sense!
So, the error is pretty straightforward- EE is expecting an exp_cookie_settings table. But… I can’t see how the heck php version should matter at all on this one.
In any case- we need to figure out why the table isn’t there and what else might be missing. Just do a quick check- there really is not an exp_cookie_settings table, correct? Or with this specific prefix, a ino_db_new.exp_cookie_settings?
If not- looks like it was first added in the 4.3.0 update and in the 6.1.0.rc_1 updates (the v4 one was added after the fact for model reasons).
The fact it’s not there is somewhat worrisome, mostly because it leaves us wondering why it was skipped and whether anything else might have been skipped.
If it were me, I’d open up the system/ee/installer/updates/ud_04_03_00.php file and just sort of spot check that the other database changes did happen. You don’t have to check everything, but the stuff before and after the cookie change, check it’s in there. I’d do the same with 6.1.0rc.
If you’re comfortable everthing is good? The table mysql code is in the installer schema file:
$Q = "CREATE TABLE `exp_cookie_settings` ( `cookie_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cookie_provider` varchar(50) NOT NULL, `cookie_name` varchar(50) NOT NULL, `cookie_lifetime` int(10) unsigned DEFAULT NULL, `cookie_enforced_lifetime` int(10) unsigned DEFAULT NULL, `cookie_title` varchar(200) NOT NULL, `cookie_description` text NULL, PRIMARY KEY (`cookie_id`) )";
Or what I’d likely do- manually set your version number back to say 5.20.0 or something and rerun the manual update. Going through a major version bump, that may/may not run into an issue, but it’s quick and easy.
In any case- immediate issue is it appears there’s a table missing. But you’ll want to do a good spot check and be sure that’s all that’s missing.
@Robin Sowell: thanks for your full and thorough response. I have rolled the site back to EE5 and redone the “auto” update and it upgrades to EE6, but I get the following message:
Warning Your ExpressionEngine installation’s version (5.4.3) is not consistent with the reported version (6.4.14). Please update your installation of ExpressionEngine again.
I have run and re-run the update multiple times now and I always get the same message.
It sounds to me like it’s not able to update the version number in the config.php file. I’d definitely check permissions there and check the $config[‘app_version’]. It’s probably the old version, but the files did update, which is why you’re getting the warning.
If the app_version is the old one, do a quick check to just to be sure the database changes ran. Let’s see the last db change for v6….
So- check in the database, the exp_extensions table. ‘enabled’ should be an index, see attached.
If that looks good, you can manually change the version number and you’re all set. But be sure your config is writable so you don’t run into it in the future.
There is no “enabled” in the indexes, see attached. Also the config file has file permissions 666. If I change the version number (see below), the message goes away, but it still breaks when the PHP is changed from 5.6 to 7.3. Just for the record, it breaks even if I don’t change the app version.
$config['app_version'] = "6.4.14";
Update: I have rolled the site back to the 5.4.3 version and this also breaks when PHP is changed from 5.6 to 7.3.
I have a horrible feeling that it is something to do with the fact that it was built on CartThrob… This has been a bitch to remove. I have commented out all the CartThrob code in the templates, but there are still CartThrob tables in the database. I have uninstalled the CartThrob Addon, of course, as well as all the other Addons.
Hrm, so I’m not at all sure it successfully ran then.
So here’s what I’d do with a super messy one. I’d manually upgrade each of the major version upgrades. And I’d make sure errors are set to show (sounds like that’s done).
So you’ve rolled back to 5.4.3. Can you get it working at all- roll back php if needed. But you want to know you’re on a clean, working install. That’s not absolutely necessary, but if at all possible. Make sure what you have works.
Then I’d grab latest v6- https://github.com/ExpressionEngine/ExpressionEngine/releases/tag/6.4.14
I’d make sure I have a backup of the current, working database. I’d drop in the newest versions of all installed add-ons, I’d remove the system/user/addons/x folders for anything not installed.
Manually upgrade https://docs.expressionengine.com/v6/installation/updating.html#updating-manually
If it breaks, you should be able to figure out where it breaks either given seeing an actual error and/or go look at the app version in the config. If it says 6.1.2 then you know THAT was successful and it broke in the next update file after that.
It helps you zero in on where it goes wrong.
If it’s REALLY super finicky, I’d make sure it works on v6. Backup the database, then try the 1-click to 7. You should be able to just manually go to 7 in 1 manual upgrade using the latest version and the above is overkill. So… it just depends on how tiny you like your increments.