PrestaShop Installation on Windows - Unable to generate private keys using OpenSSL

PrestaShop Installation on Windows - Unable to generate private keys using OpenSSL

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

PrestaShop Installation on Windows - Unable to generate private keys using OpenSSL

When attempting to launch a PrestaShop instance via http://localhost/prestashop on a Windows environment running XAMPP, you may encounter an immediate blocker in the diagnostic phase. The error message explicitly states: "Unable to generate private keys using openssl_pkey_new." This indicates that PHP's internal OpenSSL extension cannot successfully initialize the cryptographic context required for SSL/TLS operations, even if you are running locally without HTTPS.

The root cause is rarely a missing OpenSSL installation; rather, it stems from how XAMPP configures its environment and how PrestaShop validates its security setup during installation. When openssl_pkey_new fails, PHP often defaults to an error level that halts execution or throws a generic warning, preventing the installer from proceeding.

The Core Configuration Mismatch

The specific error references openssl.cafile, but this is often a red herring in local development scenarios. The function openssl_pkey_new attempts to generate a new private key for an SSL certificate. In a production environment using Let's Encrypt or self-signed certificates, the CA file path matters. However, on a fresh PrestaShop installation running via localhost, you typically do not have a valid Certificate Authority (CA) bundle configured in your PHP settings yet.

In XAMPP, the default php.ini often points to system-level OpenSSL libraries that might lack specific configuration files or expect paths relative to a Windows directory structure that differs from Linux-based servers. If your php.ini contains a line like:

openssl.cafile = C:/Windows/System32/Drivers/etc/ca-bundle.crt

And that file does not exist or is inaccessible, PHP will fail silently or crash the initialization routine when trying to generate keys. The solution is not necessarily to install a CA bundle immediately but to ensure PHP can fallback gracefully or skip the key generation check if no certificate is present.

Resolving the OpenSSL Path Issue

To fix this, you must inspect your XAMPP installation's php.ini file, usually located in \xampp\php\. Look for any hardcoded paths related to OpenSSL or CA certificates. If openssl.cafile is defined but points to a non-existent file, comment it out:

;openssl.cafile = C:/path/to/missing/file.crt

Additionally, ensure that the openssl.dll extension is actually loaded in the extension section of your config file. Sometimes XAMPP installations on Windows 10 ship with OpenSSL support but fail to register the DLL correctly due to version mismatches between the PHP runtime and the bundled OpenSSL library.

You can verify this by creating a temporary phpinfo() script in your web root and searching for "OpenSSL". Check the values for openssl.cafile and openssl.conf. If they are empty or point to invalid locations, PrestaShop's installer might misinterpret this as a critical failure.

Handling the Installer Logic

PrestaShop's installation process attempts to force HTTPS validation even during local setup in newer versions. If the system detects that SSL is required (due to HTTPS being forced in configuration) but cannot generate keys because of the missing CA file or invalid OpenSSL path, it throws this diagnostic error.

The most robust fix involves disabling the requirement for a valid private key during the initial installation phase if you are strictly working on localhost. In many XAMPP setups, you can modify the .htaccess file in your PrestaShop root directory to force HTTP temporarily:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

While this forces HTTPS, the real goal here is to stop the installer from demanding a key. If you cannot generate one, you may need to bypass the strict SSL check in the PrestaShop configuration file (config/defines.php) or ensure that your php.ini does not enforce a strict CA path until certificates are properly installed.

Finalizing the Setup

Once you have commented out invalid openssl.cafile entries and confirmed that openssl.dll is loaded, restart the Apache server in XAMPP Control Panel. Access the installation URL again. The diagnostic screen should now pass, allowing you to proceed with database creation and store setup. If issues persist, ensure your OpenSSL version matches what PHP expects; mixing 32-bit and 64-bit libraries is a common source of failure on Windows that manifests as generic "unable to generate keys" errors.

Our network