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.
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:
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.
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.
Open xampp control panel. Go to the apache config and select httpd-xampp.conf.
Here you need to update the following:
Turn php7 to php 8
Turn php7_module to php_module
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.
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.
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