Troubleshooting Error 500 When Migrating a PrestaShop 1.7 Site to Localhost

Migrating PrestaShop to Localhost: A Deep Dive into Resolving Error 500

This insight summarizes a PrestaShop forum thread where a user, FS47, encountered an Error 500 while attempting to migrate a live PrestaShop 1.7.8.11 site to a local development environment using Laragon. The thread provides valuable troubleshooting steps for anyone facing similar issues.

Initial Problem:

FS47 successfully installed Laragon, created a database (named identically to the live database), imported the SQL dump, and copied the 'public_html' files to Laragon's WWW directory. However, after updating the _short_url table and attempting to edit the database credentials (which were missing from the expected settings.inc.php), the site returned an Error 500.

Key Discussion Points and Solutions:

  • Configuration File Location: Eolia pointed out that in PrestaShop 1.7, the database credentials are located in /app/config/parameters.php, not settings.inc.php.
  • Domain Redirection: After updating the database credentials, the site redirected to the live domain. The user had to ensure the _short_url table was correctly updated to 127.0.0.1.
  • SSL Certificate Issues: The error shifted to an SSL-related issue, as the local environment lacked a valid SSL certificate. Eolia suggested disabling SSL verification in the PrestaShop back office (BO), which was inaccessible to the user at that point.
  • Cache Clearing: Clearing the cache was recommended. The cache directory location was identified as /var/cache. The user was advised to delete the contents of cache and cache- directories.
  • .htaccess Configuration: 4presta suggested modifying SEO & URLs settings in the back office to regenerate the .htaccess file after URL rewriting is disabled and re-enabled. The user initially deleted the .htaccess file, which was not the correct approach.
  • Debugging Mode: ComGrafPL recommended enabling debug mode to identify the root cause of the error. This was achieved by modifying config/defines.inc.php:
define('_PS_MODE_DEV_', false);

was changed to:

define('_PS_MODE_DEV_', true);
  • Database Credentials (XAMPP): The user later switched to XAMPP and inquired about default database credentials. Eolia advised against using the root user and recommended creating a dedicated PrestaShop user with appropriate privileges.
  • Missing Constants: Enabling debug mode revealed issues with missing constants, potentially indicating incomplete or corrupted configuration files.

Outcome:

While the thread didn't reach a definitive resolution, it provided numerous troubleshooting steps and insights into common pitfalls when migrating a PrestaShop 1.7 site to a local environment. The suggestions covered database configuration, cache management, .htaccess settings, and debugging techniques.

Mediacom87 chimed in with a contrarian view, suggesting that developing directly on a live (or staging) server avoids the complexities of local development.

coeos.pro mentioned that _PS_THEME_MOBILE_DIR_ has been removed from PrestaShop for a while, though its relevance to the main issue is unclear.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools