Laragon 4.0.15 - Apache fails to start after switching to PHP 8

Viewed 3248

On Windows 10 Pro, after downloading PHP 8, switching to it in Laragon (PHP > Version) and restarting Apache, I get the following error:

httpd: Syntax error on line 546 of
C:/laragon/bin/apache/httpd-2.4.35-win64-VC15/con...:
Syntax error on line 2 of
C:/laragon/etc/apache2/mod_php.conf: Can't locate
API module structure 'php8_module' in file
C:/laragon/bin/php/php-8.0.2-Win32-vs16-x64/php8a...:
No error
2 Answers

After a fair bit of head scratching, the fix was fairly simple - in file

C:/laragon/etc/apache2/mod_php.conf

I changed

LoadModule php8_module to LoadModule php_module

It seems Laragon fouls up the auto-configuration of PHP 8

GOTO

C:/laragon/etc/apache2/mod_php.conf

AND REPLACE THIS

#This file is auto-generated, so please keep it intact.
LoadModule php8_module "C:/laragon/bin/php/php-8.0.6-Win32-vs16-x64/php8apache2_4.dll"
PHPIniDir "C:/laragon/bin/php/php-8.0.6-Win32-vs16-x64"
<IfModule mime_module>
    AddType application/x-httpd-php .php
</IfModule>

WITH THIS

#This file is auto-generated, so please keep it intact.
LoadModule php_module "C:/laragon/bin/php/php-8.0.6-Win32-vs16-x64/php8apache2_4.dll"
PHPIniDir "C:/laragon/bin/php/php-8.0.6-Win32-vs16-x64"
<IfModule mime_module>
    AddType application/x-httpd-php .php
</IfModule>
Related