Error 500 on PrestaShop: Finding the Cause and Fixing It

A 500 error on a PrestaShop store tells you almost nothing about its cause. It only means the server could not run the page you asked for. The good news is that PrestaShop can show you the exact message hidden behind it, and that message is usually enough to find the file, the module or the setting at fault.

What a 500 error really means

The 500 code is a generic server response. It appears when PHP hits a fatal error, when a module calls a function that no longer exists, when a script runs out of memory or when a configuration file contains a mistake. As long as the error stays hidden you are working blind, so the first step is always to make it visible.

Step 1, turn on debug mode

If you can still reach your back office, go to Advanced Parameters > Performance, set debug mode to Yes and save. Then reload the page that showed the 500 error, and the full message will appear instead of the empty page.

If the back office is broken too, connect to your hosting account with FTP or the file manager, open /config/defines.inc.php and find the following line.

define('_PS_MODE_DEV_', false);

Replace false with true, save the file and reload the page.

define('_PS_MODE_DEV_', true);

Debug mode shows errors to every visitor. On a live store, the official PrestaShop help center suggests limiting it to your own IP address, so you can read the messages without showing them to your customers.

if (!defined('_PS_MODE_DEV_')) {
    define('_PS_MODE_DEV_', $_SERVER['REMOTE_ADDR'] == 'YOUR_IP');
}

Step 2, read the message and the log file

The message usually gives an error type, a file and a line number. The file path is the most useful clue. A path starting with /modules/module-name/ points straight at the module involved, while a path inside /override/ points at an override installed by a module.

If nothing shows on screen, open the /var/logs/ folder at the root of your store. Since PrestaShop 1.7, the prod.log file in that folder keeps the errors that occur in production mode. The Advanced Parameters > Logs page in the back office also records PHP errors, sorted by severity.

Step 3, fix the cause

A module is involved

Disable the module named in the message from the module manager if you can reach it. If the error locks you out of the back office, our article on finding a conflicting module explains how to neutralize it without going through the admin panel.

PHP memory is too low

A message containing Allowed memory size exhausted means the script used more memory than it is allowed. PrestaShop recommends a memory_limit of at least 256 MB, which you can set in your hosting control panel or ask your host's support to change.

The PHP version does not fit

An error that appears right after a PHP version change often comes from a module or theme that was not written for that version. PrestaShop 9 requires at least PHP 8.1, and an older module may simply refuse to run on these recent versions.

The cache holds outdated files

After an update, stale cache files can trigger a 500 error. Clear the cache from Advanced Parameters > Performance, or delete the contents of the /var/cache/prod/ folder, which PrestaShop rebuilds automatically.

Step 4, turn debug mode off

Once the error is fixed, set _PS_MODE_DEV_ back to false or switch debug mode off in the back office. Left on, it slows your store down and can expose technical details to any visitor.

Frequently asked questions

Can a 500 error come from my host?

Yes. A resource limit being reached, a malformed .htaccess file or a server incident all produce the same code. If debug mode shows no PrestaShop message, the error log provided by your host is the next place to look.

Does debug mode work on PrestaShop 8 and 9?

Yes. The _PS_MODE_DEV_ constant in /config/defines.inc.php and the option in the Performance page exist in versions 1.7, 8 and 9.

Can turning on debug mode cause data loss?

No, debug mode only changes how errors are displayed. Still, make a copy of defines.inc.php before editing it, so you can roll back if you make a typo.

Still getting the error, or the message makes no sense? Describe your problem and send us the message you see. The diagnosis is free, you get an estimate of the time and price before you buy anything, and the work is billed in 30-minute blocks.

Request a free diagnosis

Comments

Be the first to comment on this article.

Leave a comment

Your rating *
Loading...
Back to top