Update PHP in XAMPP and Composer in 1 minute (2023)

Written by Shan Shah
Updated on January 15, 2023
4 mins read
update php in xampp and composer-latest

Do you know that you can update PHP in the XAMPP server within a few minutes? This article tells you how to update PHP for Xampp and composer.

Case:

I was trying to make a new build of Laravel with laravel new project-name but the composer was making it with the old version 8.

As Laravel 9 requires PHP 8, my composer was linked to PHP 7.

So, even after running the composer global update didn't update the overall packages.

Then, I figured out that it could be the issue of PHP of my xampp with the composer.

3 simple steps to update PHP 7 to PHP 8 in XAMPP:

Note:

Before moving forward make sure to take backup (Optional but just in case if something went wrong).

Download PHP from the latest Xampp:

You can download source code of xampp windows from source forge.

xampp source code

Extract the folder and copy php folder from the latest xampp.

Now, go to your existing xampp folder and rename the current PHP folder to php7 or whatever you want.

Then paste the new php folder in the existing xampp.

That's it! You have finally put the latest php inside Xampp.

But, the process does not end here.

Let's move to the next step.

Configure httpd-xampp.conf

Open xampp control panel. Go to the apache config and select httpd-xampp.conf.

httpd-xampp .conf php

Here you need to update the following:

Turn php7 to php 8

update php 7 to php 8

Turn php7_module to php_module

update php in xampp
update php in xampp
how to update php

Save it! Now, if you will try to run apache. It will work fine.

If you go to localhost/dashboard/phpinfo.php, you will see the latest php version.

But, when you try to run composer. It will fail and will give tons of errors.

Let's move to the final step.

Fix Composer after XAMPP PHP update

Go to xampp control panel, click on apache config and go to php.ini.

php ini

Inside php.ini, set the absolute paths like \xampp\php to F:\xampp\php

F: (Where you have installed directory of xampp, in my case it's F)

Find \xampp\php inside php.ini and change all paths from relative to absolute.

Click save and then go to the command line.

Type composer you will see the output of Composer instead of errors.

Fix PhpMyAdmin Error

After the above process, if your phpmyadmin is broken then follow the steps mentioned below.

You copied the PHP folder and placed it inside your existing xampp. Just like that, you will need to copy the PhpMyAdmin from the new xampp to your existing one.

But, before that make sure to get the backup of the existing config.inc.php file which is inside PhpMyAdmin in xampp, and then replace the complete folder with the new one.

Now, replace the config.inc.php file with the old one.

fix phpmyadmin error

Re-run your xampp's Apache and MySQL. After that visit the phpmyadmin dashboard.

The Errors should be gone.

That's it! In a nutshell, you learned:

  • How to download the source code of xampp
  • How to change php version in xampp
  • How to update PHP7 to PHP8
  • How to fix the composer issue after the update to PHP8.
  • How to fix PhpMyAdmin Error

If you want to become smart in web development make sure to subscribe to our newsletter and don't forget to share with others.

Project Based Tutorials
Tips & Tricks
Modern Technologies
Real-World Challenges
Creative Content
Build-Apps from Scratch
Web Development Content
17+ Videos Published
Coder Champ © 2023 - 
Privacy Policy
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram