UA EN
Telegram

Articles · 2026-11-07

OpenCart after a PHP 8 upgrade: what breaks

Your host is retiring PHP 7.4, you switch the version and the store shows a white screen or a page of errors. It’s a common situation, and it’s almost always fixable without rebuilding the store.

Why it happens

PHP 8 removed deprecated functions and became strict about mistakes PHP 7 silently ignored. Older OpenCart cores and especially third-party modules were written for PHP 5–7 and fail at exactly those spots.

  • OpenCart 2.x and early 3.0.x don’t run on PHP 8 without patches;
  • in later 3.0.x the core is largely compatible, but modules and themes often aren’t;
  • OpenCart 4 targets PHP 8, but 3.x modules don’t work on it.

Typical errors and what they mean

Find the message in the error log (system/storage/logs/error.log or the PHP log in your hosting panel): it names the file and line.

  • Call to undefined function each() / create_function() — removed in PHP 8; rewrite with foreach and closures;
  • count(): Argument #1 must be of type Countable|array — code counts a variable that is sometimes null; this used to be a warning and is now fatal;
  • Undefined array key / Undefined variable — warnings, but with error display on they break the layout and the AJAX cart;
  • Required parameter follows optional parameter — outdated parameter order in module functions;
  • ionCube Loader … not installed — an encoded module; you need the vendor’s build for your PHP version.

How to upgrade without downtime

  • copy the site and database to a staging subdomain;
  • switch the copy to PHP 8, log errors to a file and turn on-screen display off;
  • walk through the main flow: home, category, filter, product, cart, checkout, payment, admin;
  • fix core and module errors, update modules that have PHP 8 releases;
  • clear the modification and Twig caches and switch PHP on the live site.

For a typical OpenCart 3 store with 15–30 modules this takes one to a few days of work.

What not to do

Don’t switch the live site to PHP 8 just to see what happens, and don’t “fix” errors by hiding them: warnings disappear, but fatal errors in the cart or payment stay, and you learn about them from lost orders.

FAQ

Can I stay on PHP 7.4?

Temporarily, if your host allows it. But 7.4 no longer gets security updates and hosts are phasing it out. A planned upgrade beats the day the old PHP gets switched off.

Isn’t it simpler to move to OpenCart 4?

That’s a separate, large project: a new theme, new modules and a data migration. For most stores it’s cheaper and safer to prepare the current OpenCart 3 for PHP 8.

Rather not dig into it yourself?

Tell me what is happening with your site, and I’ll reply with the cause and a fix estimate within a day.

Service: Website speed & PHP 8 upgrade →

Telegram
Telegram Call