- PHP

How to change the PHP version in XAMPP

PHP version can make the real difference. We always should be developing our applications on the exact same PHP version as it is installed on our production server to avoid compatibility problems.

Newer PHP versions are usually not only better but also faster. That’s why with PHP we should always stick with new versions. For 2022 I personally wouldn’t build anything new on PHP version older than 7, or even the newest 8 which seems to be fast and stable as well.

To change the PHP version in XAMPP, you should install the specific version of XAMPP. Before that, I’d recommend you to make a backup of your projects (htdocs) and database files.

You can see the XAMPP version on https://www.apachefriends.org/download.html.

How to change the PHP version without reinstalling the program?

Let’s say you are developing two applications. The old one is running on PHP 5.6, while the newest one requires PHP 8.

There are too many differences between these two versions to go for some compromises. If you don’t want to reinstall the XAMPP every time you switch the project, you should have two separated environments (e.g. virtual machines) or use containerization (e.g. Docker).