A white screen in OpenCart almost always means a PHP fatal error that the core did not catch: a syntax error, running out of memory, a missing class, or an unhandled exception. A 500 error is the same thing, except the server also returns a status code. To find the cause, you first need to see the error text, and it almost never ends up in the error log in the admin. Below is how to get that text and the most common causes in 3.0 and 4.1.
Examples are for OpenCart 4.1; in 4.0.x, model triggers and event handling work differently.
White screen or 500: what exactly is happening?
First, determine what the server returns. Open the Network tab in your browser's developer tools or run curl -I https://.
| What you see | What it usually means | Where to look |
|---|---|---|
| Code 200, empty page | PHP stopped with a fatal error, and error display is turned off | PHP log |
| Code 500, web server page | PHP fatal error or web server configuration error (.htaccess) | PHP log and web server log |
Redirect to error.html (4.1) | unhandled exception with error display turned off | OpenCart error.log |
PHP8.1+ Required text | PHP version lower than the minimum | PHP settings on the hosting |
| White screen on only one page | error in a specific controller, model, template, or modification | PHP log, error.log |
It matters where the white screen appears: on the storefrontWhat the customer sees: the home page, categories, product page, and cart. More in the glossary →, in the admin, or everywhere. If the admin works but the storefront doesn't, the cause is in the storefront code (theme, module, modification). If everything is down, suspect shared components: config.php, the database, the PHP versionThe language version on the hosting. 3.0.4.1 requires at least PHP 7.3, while 3.0.5.1 and 4.1.0.4 require at least PHP 8.1; check extension compatibility before updating. More in the glossary →, storage, or a modification to a core file.
How do you see the real error?
OpenCart sets its own error handlers, but it does not pass along fatal errors of the E_ERROR level (including running out of memory and exceeding the execution time limit) or PHP syntax errors. In 3.0, there is also no exception handler, so any unhandled exception, including an SQL error, also bypasses error.log. The article about the error log in OpenCart explains what does and does not get written to the OpenCart log.
Method 1: PHP log on the server
This is the safest approach, because customers see nothing. On shared hosting, this is usually the "Logs" or "Error log" section in the control panel; on a VPS, it is the PHP-FPM or web server log. Look for lines containing PHP Fatal error or PHP Parse error with the time the error occurred.
Method 2: temporarily show errors only for yourself
If there is no PHP log or it is unavailable, enable error display at the PHP level only for your IP address. Add index.php (or admin/index.php if the white screen is in the admin) at the beginning of the file, right after <?php:
Example: temporarily show fatal errors for one IP only
if (($_SERVER['REMOTE_ADDR'] ?? '') === '203.0.113.10') {
ini_set('display_errors', '1');
}
Here, 203.0.113.10 is your address. If the site is behind Cloudflare or another proxy, REMOTE_ADDR will contain the proxy's address, so compare against the HTTP_CF_CONNECTING_IP header instead. You don't need to configure the error level: system/startup.php sets error_reporting(E_ALL) in both versions. Remove this line after diagnosis.
Method 3: showing OpenCart errors through the database
For Notices and Warnings (for example, when a page stops midway), it is enough to enable Display Errors on the "Server" tab in the settings. If the admin also won't open, change the setting directly in the database:
Example: enable OpenCart error display without the admin
UPDATE oc_setting SET `value` = '1'
WHERE `store_id` = 0 AND `key` = 'config_error_display';
Don't forget to revert '0' after diagnosis. Displaying errors on a live site breaks AJAX and payment gateway callbacks, and it reveals file paths to customers.
flowchart TD
A["White screen or 500"] --> B{"PHP log available?"}
B -- "yes" --> C["Find Fatal or Parse error"]
B -- "no" --> D["display_errors for your IP only"]
D --> C
C --> E{"Path contains storage/modification?"}
E -- "yes, 3.0" --> F["OCMOD modification: refresh or disable"]
E -- "no" --> G{"Allowed memory size or Maximum execution time?"}
G -- "yes" --> H["Server resources, large photos, loops"]
G -- "no" --> I["Module, theme or core file from the error line"]
Common causes and how to fix them
OCMOD modification (3.0)
In 3.0, OCMOD does not change the original files. Instead, it places modified copies in the DIR_MODIFICATION directory (by default system/). The core includes these copies instead of the originals through the modification() function. If the path in the error message contains storage/, the modified copy is what's breaking. There are usually three causes: the modification inserted code in the wrong place, the original file was updated but the copies remained old, or two modifications conflict.
- If the admin works: go to ExtensionsAdditional functionality: a module, a payment or shipping method, a feed, or a theme. They are managed in "Extensions → Extensions." More in the glossary → → Modifications, disable the most recently installed modification, and click Refresh.
- If the admin is also white: delete the contents of the
storage/directory (keep the directory itself). The original files are not affected, and the site will work without modifications. Then, in the admin, disable the problematic one and click Refresh to restore the rest.modification/

The article about diagnosing OCMOD explains how to find which modification is at fault.
Out of memory and timeouts
Allowed memory size of ... bytes exhausted and Maximum execution time of ... seconds exceeded are PHP limits, not code errors in the strict sense. Typical causes in OpenCart:
- Resizing large photos. The first display of a category with photos several thousand pixels wide forces GD to unpack each one into memory. After the first display, the thumbnails are cached, so the error appears "sometimes, then not."
- A module that selects all products. Feeds, sitemaps, and filters that pull the entire catalog into a single array.
- Infinite recursion. For example, an event handler calls a method that is itself subscribed to the event, so the event fires again.
Increasing memory_limit removes the symptom, but for feeds and imports it is better to process data in batches or move them to CLI.
PHP version
system/startup.php checks the minimum version: 7.3 for 3.0.4.1, 8.1 for 3.0.5.1 and 4.1.0.4. An older version does not produce a white screen but a short message PHP8.1+ Required (in 3.0.4.1, PHP7.3+ Required). More often, the reverse happens: the hosting upgraded PHP, and an old module written for PHP 7 fails on PHP 8 with TypeError or a call to a removed function. The error line will point to the module file. In that case, update the module or temporarily switch back to the previous PHP version in the hosting control panel.
Storage, vendor, and config.php after a migration
Twig and other libraries in both versions are located in storage/vendor/, but they are included differently. In 3.0, system/startup.php includes DIR_STORAGE . 'vendor/ only if the file exists. If the file is missing, the core silently skips the include and fails later: on the first template render, an error like Class "Twig\Loader\ArrayLoader" not found appears. In 4.1, system/startup.php registers its own core autoloader and loads system/vendor.php, where library namespaces are mapped to directories inside DIR_STORAGE . 'vendor/. If files are missing, the autoloader cannot find the class, and the error appears where that class is first needed. This happens when storage was moved outside the public directory and its contents were not fully copied. It can also happen when DIR_STORAGE in config.php for the storefront and the admin point to different locations.
After migrating to another host, check the absolute paths config.php in both DIR_*, database access (DB_*), and that the storage directories are writable by PHP. The purpose of each constant is explained in the article about config.php, and the storage layout is explained in the article about the storage directory. The general migration procedure is described in the guide to moving a site to another host.
Twig template error
A syntax error in .twig (an unclosed {% if %}, an unknown filter) stops rendering, and the versions behave differently. OpenCart 3.0 (3.0.4.1 and 3.0.5.1): in system/, rendering is wrapped in try/catch, but the file is in the Template namespace, and the block is written as catch (Exception $e) without a leading backslash. As a result, it does not catch Twig exceptions: the exception remains unhandled, and 3.0 has no custom exception handler. The Twig error text with the template line number only goes to the PHP log (PHP Fatal error: Uncaught ...), and nothing is written to the OpenCart error.log. Even if the catch did trigger, trigger_error() only writes "Error: Could not load template ...!" without the Twig error text. OpenCart 4.1: a Twig syntax error is converted into a new exception that contains only the template name, without the Twig error text. error.log will show "Could not load template ...!", and you will have to find what is wrong in the template manually. If the white screen appeared after editing a theme, first check the changed template and clear the theme cache in the developer settings (the gear icon on the admin control panel). The syntax of templates is covered in the article about Twig in OpenCart.
Event handler
If an event points to a controllerCode that receives a request and prepares data. More in the glossary → that no longer exists (the module was deleted but the event was not), the core does not crash in either version: Action returns an error object, and the handler is skipped. However, a handler that exists but contains an error breaks every page where its trigger fires. If the white screen appeared after installing a module, disable its events in Extensions → Events. The article about the event system describes how triggers work.
How do you prevent a white screen on a live site?
- A test copy. Install modules and update the theme and PHP first on a copy of the site with the same PHP version.
- A linter before uploading.
php -l file.phpcatches syntax errors before the file reaches the server. For a module package, you can run it in a loop over all.php. - Defensive code in modules. Wrap an event handler that calls an external API in
try/and write the error to the log. A failure of a shipping service should not take down a product pageThe page for a single product: photos, price, options, description, reviews. More in the glossary →.catch (\Throwable $e) - Monitoring. The simplest availability check with an alert on any code other than 200, or on an unusually short response, will reveal a white screen before customers do.
- A backup before changes. A copy of the files and database before installing a module turns an hour of diagnosis into a five-minute rollback.
If you don't have time to diagnose the problem yourself, you can order OpenCart bug fixes and improvements.
Summary
- A white screen is a PHP fatal error that the core did not catch. The cause is visible in the PHP log, not in the admin error log.
- If there is no log, temporarily enable
display_errorsfor your IP only at the beginning ofindex.php. - A path containing
storage/in 3.0 points to OCMOD: disable the modification and refresh the modification cache, or clear the directory.modification/ - Out-of-memory errors and timeouts are caused by large photos, resource-hungry modules, and recursion in events, not just a low limit.
- After a migration, check
config.php, the completeness ofstorage/vendor/, and write permissions. - In 3.0, look for a Twig template error in the PHP log as an unhandled exception with the Twig text. In 4.1, it reaches error.log only with the template name, without the Twig error text.
Other materials on debugging, performance, and module code quality are collected in the section "Debugging, performance and code quality".