Page 1 of 1
updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 4:17 pm
by ianhaney50
My client needs to update to php version 8 but opencart 2.0.3.1 don't seem to work on php 8 so after looking around on the forum, I found a post that said to try this patched version of 2.3.0.2 at
https://github.com/condor2/Opencart_230x_PHP_8
I downloaded the files from that link and replaced the code it says to in the two config files and gone to the install url but it's got the following error
Fatal error: Uncaught Exception: Error: Could not make a database link using DBUSERNAME@localhost!<br>Message: Access denied for user 'DBUSERNAME'@'%' to database 'DBNAME' in /httpdocs/catalog/system/library/db/mysqli.php:21 Stack trace: #0 /httpdocs/catalog/system/library/db.php(31): DB\MySQLi->__construct() #1 /httpdocs/catalog/install/controller/startup/database.php(19): DB->__construct() #2 /httpdocs/catalog/system/engine/action.php(51): ControllerStartupDatabase->index() #3 /httpdocs/catalog/system/engine/front.php(34): Action->execute() #4 /httpdocs/catalog/system/engine/front.php(19): Front->execute() #5 /httpdocs/catalog/system/framework.php(158): Front->dispatch() #6 /httpdocs/catalog/system/startup.php(112): require_once('...') #7 /httpdocs/catalog/install/index.php(42): start() #8 {main} thrown in /httpdocs/catalog/system/library/db/mysqli.php on line 21
Can anyone help please and how I can fix it
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 6:01 pm
by ADD Creative
Check your database credentials in the config.php. The error is telling you they are wrong.
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 6:15 pm
by ianhaney50
ADD Creative wrote: ↑Tue Sep 19, 2023 6:01 pm
Check your database credentials in the config.php. The error is telling you they are wrong.
I checked the credentials and they are correct as they are the same that was on 2.0.3.1 and worked on there when it was 2.0.3.1
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 7:19 pm
by paulfeakins
ianhaney50 wrote: ↑Tue Sep 19, 2023 4:17 pm
My client needs to update to php version 8
No they don't, they can run on a hardened PHP 7.4.33.
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 7:24 pm
by ianhaney50
paulfeakins wrote: ↑Tue Sep 19, 2023 7:19 pm
ianhaney50 wrote: ↑Tue Sep 19, 2023 4:17 pm
My client needs to update to php version 8
No they don't, they can run on a hardened PHP 7.4.33.
I'm going to update it to 3.0.3.8, can that be done from 2.0.3.1 to 3.0.3.8 if I run the install/upgrade script after uploading the files apart from the config files?
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 9:52 pm
by ADD Creative
ianhaney50 wrote: ↑Tue Sep 19, 2023 6:15 pm
I checked the credentials and they are correct as they are the same that was on 2.0.3.1 and worked on there when it was 2.0.3.1
Maybe that version has some sort of bug with the database connection. It does seem to have a lot of unnecessary changes.
ianhaney50 wrote: ↑Tue Sep 19, 2023 7:24 pm
I'm going to update it to 3.0.3.8, can that be done from 2.0.3.1 to 3.0.3.8 if I run the install/upgrade script after uploading the files apart from the config files?
OpenCart 3.0.3.8 is not fully compatible with PHP 8. If using PHP 8 you will need the latest maintenance code from
https://github.com/opencart/opencart/tr ... aintenance.
While the upgrade may work it often has many bugs. It's best to test it first on a copy of your site. Also be aware any themes and most extensions for 2.x will not be compatible with 3.x. It can often be simpler to export the data using an import/export tool and then import that data into a clean install of a later version.
Have a good search of the forum for ways to approach the upgrade.
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Tue Sep 19, 2023 11:33 pm
by ianhaney50
ADD Creative wrote: ↑Tue Sep 19, 2023 9:52 pm
ianhaney50 wrote: ↑Tue Sep 19, 2023 6:15 pm
I checked the credentials and they are correct as they are the same that was on 2.0.3.1 and worked on there when it was 2.0.3.1
Maybe that version has some sort of bug with the database connection. It does seem to have a lot of unnecessary changes.
ianhaney50 wrote: ↑Tue Sep 19, 2023 7:24 pm
I'm going to update it to 3.0.3.8, can that be done from 2.0.3.1 to 3.0.3.8 if I run the install/upgrade script after uploading the files apart from the config files?
OpenCart 3.0.3.8 is not fully compatible with PHP 8. If using PHP 8 you will need the latest maintenance code from
https://github.com/opencart/opencart/tr ... aintenance.
While the upgrade may work it often has many bugs. It's best to test it first on a copy of your site. Also be aware any themes and most extensions for 2.x will not be compatible with 3.x. It can often be simpler to export the data using an import/export tool and then import that data into a clean install of a later version.
Have a good search of the forum for ways to approach the upgrade.
Yeah could well be a bug in that one I downloaded.
It's not easy unfortunately doing a test one as I don't host the site and I don't have access to cPanel or anything as they won't give the info over as it's got sensitive info on it and has other websites on it so I'm having to wait for the client to do anything for me such as creating databases or doing database backups etc.
Luckily the site is using default theme and I've looked at the extensions being used and I can get them on version 3.0.3.8
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Wed Sep 20, 2023 5:03 pm
by paulfeakins
ianhaney50 wrote: ↑Tue Sep 19, 2023 7:24 pm
I'm going to update it to 3.0.3.8,
As others have said 3.0.3.8 isn't compatible with PHP 8.
ianhaney50 wrote: ↑Tue Sep 19, 2023 7:24 pm
can that be done from 2.0.3.1 to 3.0.3.8 if I run the install/upgrade script after uploading the files apart from the config files?
It's unlikely that'll work so definitely try it on a dev copy of the site first.
We always consider upgrades from major versions to be rebuilds.
Re: updating opencart from 2.0.3.1 to 2.3.0.2 and php 8
Posted: Wed Sep 20, 2023 11:21 pm
by ADD Creative
ianhaney50 wrote: ↑Tue Sep 19, 2023 11:33 pm
Yeah could well be a bug in that one I downloaded.
It's not easy unfortunately doing a test one as I don't host the site and I don't have access to cPanel or anything as they won't give the info over as it's got sensitive info on it and has other websites on it so I'm having to wait for the client to do anything for me such as creating databases or doing database backups etc.
Luckily the site is using default theme and I've looked at the extensions being used and I can get them on version 3.0.3.8
You would need to to use the maintenance version of 3.0.3.8 and make sure the extension were compatible with that (there are differences to 3.0.3.8) and PHP 8 (not all are, as 3.0.3.8 is not and the extension will be made for that).
If you don't have direct access to the database I wouldn't attempt an upgrade as you will probably need to make some corrections, such as adding missing events and fixing issues as you go.
I would still test on a copy even if it means doing a clean install, installing all the extensions and applying any modifications. Depending on your PHP knowledge, it may be easier just to patch the current version to work under PHP 8.