How to install PHP 8 on XAMPP

How to install PHP 8 on XAMPP

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

Stefan Bogdanescu

Founder & Senior Architect

How to install PHP 8 on XAMPP

Upgrading from PHP 7 to PHP 8 on a fresh XAMPP installation often triggers an immediate Apache shutdown error. This isn't just a minor configuration glitch; it usually indicates a fundamental mismatch between the compiled Apache module and the underlying OpenSSL library or a missing dependency required for the new binary to initialize correctly. When you see the "Apache shutdown unexpectedly" message with empty log files, the crash is happening before the standard logging mechanisms can capture a stack trace, leaving you staring at a blank slate in your logs.

The most common culprit on Windows XAMPP installations is the OpenSSL configuration mismatch. While older PHP versions bundled their own openssl.cnf or relied on system defaults that happened to work, PHP 8 (specifically the DLL builds often found in XAMPP) expects a specific, validated certificate path. If Apache attempts to initialize with an invalid or missing OpenSSL context, it crashes immediately upon startup without ever loading the PHP module properly.

To resolve this, you must ensure the OPENSSL_CONF environment variable or configuration directive points to a valid certificate authority bundle. In many XAMPP setups, the default openssl.cnf included in older distributions is incompatible with PHP 8's stricter validation requirements. You should verify that the file referenced in your httpd-xampp.conf exists and contains the necessary CA certificates. If you are using a pre-compiled XAMPP package for Windows, it is highly recommended to check if the package includes an updated OpenSSL bundle or if you need to manually replace the C:/xampp/apache/bin/openssl.cnf with a known-good version compatible with PHP 8.

Another critical area of failure involves the specific DLL loading sequence. Your configuration file shows:

LoadFile "C:/xampp/php/php8ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php8_module "C:/xampp/php/php8apache2_4.dll"
LoadFile "C:/xampp/php/libsqlite3.dll"

While this structure looks correct syntactically, the order of operations matters. Apache must successfully load the PHP module before it can interpret .php files. If LoadModule php8_module fails due to a missing dependency (like a specific version of libpq or a mismatched SQLite library), Apache will terminate. Ensure that you are not mixing DLLs from different XAMPP versions. For instance, using php8apache2_4.dll alongside a PHP core built for a different architecture or OpenSSL version will result in a silent crash.

If the standard configuration does not resolve the shutdown error, consider switching to the CGI/FastCGI method instead of the module handler. The module approach (LoadModule) is generally faster but more brittle on Windows due to dependency hell. By commenting out the module load directives and uncommenting the CGI section in httpd-xampp.conf:

# Comment out these lines if switching to CGI:
# LoadFile "C:/xampp/php/php8ts.dll"
# LoadModule php8_module "C:/xampp/php/php8apache2_4.dll"
# LoadFile "C:/xampp/php/libpq.dll"
# LoadFile "C:/xampp/php/libsqlite3.dll"

# Uncomment the CGI block:
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php-cgi
</FilesMatch>
<IfModule actions_module>
    Action application/x-httpd-php-cgi "/xampp/php/php-cgi.exe"
</IfModule>

This approach isolates the PHP process from Apache's main thread, allowing it to handle its own dependencies and errors more gracefully. It is slightly slower in theory but often provides a more stable upgrade path when dealing with complex DLL dependencies on Windows.

Finally, remember that XAMPP versions can be finicky. Version 7.2.33 introduced changes to how binaries are packaged. If you encounter persistent issues after verifying your OpenSSL configuration and switching handlers, the safest bet is to ensure you are using a monolithic XAMPP installation where all PHP, MySQL, and OpenSSL components were compiled together by the same vendor. Mixing third-party DLLs into an existing XAMPP folder often breaks the internal linkage required for PHP 8 to function correctly with the Apache server.

Our network