How to Fix HTTP 500 or 504 Errors During PrestaShop 8.2.x Installation

PrestaShop 8.2.x Installation Error
PrestaShop 8.2.x Installation Error

If you’re installing PrestaShop 8.2.1 and encounter an HTTP 500 or 504 error during the final installation step (specifically under “Store installation” when installing the theme or modules), you’re not alone. Many users face this issue, and unfortunately, the error message doesn’t provide helpful details.

After thoroughly investigating the PrestaShop source code and server logs, we have identified the root cause and developed a reliable solution. This post will walk you through it step-by-step.

Prerequisites

Before diving into the solution, ensure your server meets the minimum PHP settings to support PrestaShop installation:

  • memory_limit should be at least 256M
  • max_execution_time should be at least 300
  • max_input_vars should be at least 5000

To quickly verify whether your server meets PrestaShop’s requirements, you can use the PhpPsInfo script provided by the PrestaShop team. It scans your server setup and highlights any missing or misconfigured settings.

*Important: Although the latest PrestaShop versions officially support PHP 7.2 to 8.1, our thorough testing shows that the installation process itself only reliably succeeds on PHP 8.1. Using lower PHP versions may result in errors such as:

PHP Notice: Trying to get property 'theme_name' of non-object in var/cache/prod/ContainerVI9NYMC/appAppKernelProdContainer.php
PHP Warning: pfsockopen(): unable to connect to tcp://api.segment.io:80 (Connection timed out) in modules/ps_metrics/vendor/segmentio/analytics-php/lib/Segment/Consumer/Socket.php

Root Cause of the Error

During installation, the PrestaShop system redefines the constant _PS_DO_NOT_LOAD_CONFIGURATION_ in multiple places:

  • ./config/defines.inc.php
  • ./classes/Configuration.php
  • ./install/controllers/http/smarty_compile.php

This duplication can lead to the following errors:

  1. HTTP 500 Error – A direct PHP processing error when the constant is redefined. When checking the error log, you’ll likely see a message like this:
    PHP Notice: Constant _PS_DO_NOT_LOAD_CONFIGURATION_ already defined in install/controllers/http/smarty_compile.php
  2. HTTP 504 Error – A timeout caused by a logic loop or internal conflict when the constant value is misinterpreted due to duplicate definitions.
PrestaShop Installation - HTTP 500 Error

PrestaShop Installation – HTTP 500 Error

How to Fix It

You will need to modify the two files below. These changes allow PrestaShop to handle the constant properly during installation.

  • ./config/defines.inc.php
  • ./classes/Configuration.php

Before proceeding, it’s highly recommended to back up these files so that you can restore them after installation.

Step 1: Modify “defines.inc.php”

  1. Open the file: ./config/defines.inc.php
  2. Find the following line (around line 62):
    define('_PS_DO_NOT_LOAD_CONFIGURATION_', false);
  3. Comment it out:
    // define('_PS_DO_NOT_LOAD_CONFIGURATION_', false);

Step 2: Modify “Configuration.php”

  1. Open the file: ./classes/Configuration.php
  2. Find this block (around line 223):
    if (_PS_DO_NOT_LOAD_CONFIGURATION_) {
        return false;
    }
  3. Replace it with:
    if (defined('_PS_DO_NOT_LOAD_CONFIGURATION_') && _PS_DO_NOT_LOAD_CONFIGURATION_) {
        return false;
    }

Step 3: Clear Cache

After completing the modifications to the two files above, you need to delete the contents of the ./var/cache directory to ensure that the changes are recognized and PrestaShop’s source code is properly re-initialized.

To do this, open a terminal, navigate to the root directory of your PrestaShop installation, and run the following command:

rm -rf var/cache/*

*Important: Do not delete the cache folder itself – only its contents. Removing the cache folder may cause errors when PrestaShop tries to rebuild its cache.

Step 4: Restart the Installation

Now, you can restart the entire installation process. You may either click the “clicking here” link on the error screen or manually refresh the installation page to return to the first step (“Choose your language”) and start the process from the beginning.

Conclusion

This workaround prevents PrestaShop from crashing during the critical final phase of installation due to conflicting constant definitions. Once you have completed the installation successfully, don’t forget to restore the original versions of the modified files to maintain long-term stability.

If you run into any issues, feel free to reach out to our support team. We are here to help!

Related Articles