As developers, it's often the case that different versions of PHP and server tools are installed quickly without taking into account the architecture for which they were built. In this article, we will focus on solving a specific error that arises when running incompatible builds of PHP and Apache.
Recently, I encountered an issue when downgrading my Laragon setup from PHP 8.1 (x64) to PHP 7.x (x86). This caused compatibility problems with Apache, and I received an error message indicating that my PHP and Apache builds were not compatible, as the Apache installed was built for x64 versions of PHP.
In this article, I'll provide a step-by-step guide on how to install multiple versions of Apache on Laragon. By following these steps, you can resolve any similar issues that you may encounter.
Step 1: Download the Latest Version of Apache
Visit https://www.apachelounge.com/download/additional/ to download the latest version of Apache. The homepage provides quick access to 64-bit versions, but to access the 32-bit versions, use this URL.
Step 2: Choose Your Apache Version
From the list of recent and actively maintained Apache versions, choose the version you want to install. The most recent version is highlighted in yellow for easy reference.
Step 3: Select Your Build
On the next page, you'll find links for both the Win64 version and the Win32 version. The Win32 version is compatible with x86, while the Win64 is compatible with x64.
Step 4: Download and Locate the Zip File
The downloaded file will be in your downloads folder. Copy and paste it into the Laragon folder for Apache versions (C:\laragon\bin\apache). After unzipping, a new folder should be created.
Step 5: Delete Unnecessary Files
Open the unzipped folder and delete all unnecessary files. The actual content is inside a sub-folder named "Apache24".
Step 6: Copy Files to the Correct Location
Cut all files from the sub-folder and paste them into a new location, one folder back (C:\laragon\bin\apache\httpd-2.4.54-win32-VC15), then delete the Apache24 folder (highlighted in red).
Step 7: Update the Configuration File
Open the httpd.conf configuration file and find the line with "Define SRVROOT "c:/Apache24". Replace "c:/Apache24" with the correct path for the new Apache folder (C:/laragon/bin/apache/httpd-2.4.54-win32-VC15).
Step 8: Select the Correct Apache and PHP Versions
In Laragon, stop all services and select the new Apache version and a 32-bit PHP version suffixed with "x86".
Step 9: Start All Services
Start all services, and you should no longer encounter any errors.
In conclusion, when you encounter an error indicating that your PHP and Apache builds are not compatible, simply follow these steps to select the appropriate Apache version.
Although in this article, we downgraded Apache to match the PHP version, alternatively, we could also upgrade or downgrade PHP to match with Apache’s version.
Comments
Post a Comment