Dendi Handian
Posted on July 20, 2021
Currently I'm using Laragon Lite version, it has PHP 7.4.16 and apache 2.4.35 running well in my machine. Meanwhile PHP now has version 8 and it seems like it still supported in Windows machine. Here is my step to change version to PHP 8.
Downloading the PHP 8 Binaries
You can go to https://windows.php.net/download and you can see the option to download the latest available PHP 8 version, I got PHP 8.0 (8.0.8) at the moment.
After it downloaded, you can create a folder inside C:\laragon\bin\php
(or your own custom directory) named after the downloaded zip file. The folder name for me is php-8.0.8-Win32-vs16-x64
and then extract anything inside php-8.0.8-Win32-vs16-x64.zip
to this folder.
Switching the PHP version to 8
Try to right-click on Laragon desktop app, choose PHP, and click the php-8.0.8-Win32-vs16-x64
to change to this version.
Now run the apache too. When the apache starting to run, Laragon will pop this message:
Something is wrong and we need figure the error out.
This issue seems have been fixed in the full laragon version 5 installation as I tried it.
Fixing the Apache Error when using PHP 8
When I'm looking on the laragon forum https://forum.laragon.org/topic/2232/php-8-and-apache-2-compatibility, someone found how to fix the error with video explanation https://www.youtube.com/watch?v=P0ahcFoMwnM.
So to fix it, we need to open the C:\laragon\etc\apache2\mod_php.conf
file that contains this code:
# This file is auto-generated, so please keep it intact.
LoadModule php8_module "C:/laragon/bin/php/php-8.0.8-Win32-vs16-x64/php8apache2_4.dll"
PHPIniDir "C:/laragon/bin/php/php-8.0.8-Win32-vs16-x64"
<IfModule mime_module>
AddType application/x-httpd-php .php
</IfModule>
Look at the php8_module
. You only need to change it into php_module
so the code will be like this:
# This file is auto-generated, so please keep it intact.
LoadModule php_module "C:/laragon/bin/php/php-8.0.8-Win32-vs16-x64/php8apache2_4.dll"
PHPIniDir "C:/laragon/bin/php/php-8.0.8-Win32-vs16-x64"
<IfModule mime_module>
AddType application/x-httpd-php .php
</IfModule>
Save the file, now turn-off apache and restart it. When you access the localhost
in the browser, you should see this now:
This solution will temporary fix the issue. When you switch back to version 7.4
or else, the above configuration will reset back and you have to change it when using PHP 8. We're looking forward for the permanent solution.
Tell me if this article is helpful and helped you fix your problem in the comment below.
Posted on July 20, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.