How to Upgrade PHP Version on XAMPP —really works

Kaushal Bhavsar
2 min readApr 16, 2021

--

I am sorry about this noob headline but that’s the only thing I got in my mind. I tried several articles and tips but I was unable to upgrade the version of PHP in my XAMPP.

I already have a development setup on my Macbook but this was for the Windows machine and you know it’s a pain to install things on Windows unless it comes with an installer.

So, I needed to upgrade from PHP5 to PHP7. First, I downloaded the latest PHP version from this link: https://windows.php.net/download#php-7.0

I unzipped and installed everything into the XAMPP php directory. For me it was C:\xampp\php.

Once that was done, I changed the following lines in the httpd-xampp.conf file:

#
# PHP-Module setup
#
#LoadFile “C:/xampp/php/php5ts.dll”
#LoadFile “C:/xampp/php/libpq.dll”
#LoadModule php5_module “C:/xampp/php/php5apache2_4.dll”
LoadFile “C:/xampp/php/php7ts.dll”
LoadModule php7_module “C:/xampp/php/php7apache2_4.dll”

I restarted Apache but I could only get a generic failure message in the window (seen in screenshot below). I almost gave up after doing things again and again but as lazy as I am, I didn’t want to do the entire backup-uninstall-delete routine.

So, I found a way that worked.

Here are the steps I followed after the other tutorials didn’t work for me:

1. Open the Shell

2. Run the command “apache_start” in the shell

Here you can see the detailed error that is mentioned. There is an issue on Line1 of the configuration file.

I removed this line and now it works. I can load Apache without any errors.

If you run into any XAMPP errors again, just know that the shell is the best place to start diagnosing instead of stack overflow :)

--

--

Kaushal Bhavsar
Kaushal Bhavsar

No responses yet