How to Update Change PHP Version in XAMPP
In this tutorial for beginners, I will show you how to practically change or update the PHP version in XAMPP that too without reinstalling XAMPP. While using XAMPP for web development, there can be a point when you may be required to update or change the PHP version or say MySQL version in order to obtain some specific result. While working on some projects you may have to update the PHP version, while in some cases you may have to downgrade the PHP version.
To update the PHP version in XAMPP, you don’t have to reinstall XAMPP. Rather you can change the PHP version by following a few simple steps explained below. This approach saves you a lot of time and effort you may have consumed in reinstalling XAMPP. And those who still struggling with how to install XAMPP would surely find this article helpful. The PHP version requirement varies with the project requirements. Also you may have to employ a different version of PHP in XAMPP for one of your particular projects.
How to Change PHP Version XAMPP
As we know XAMPP is an open source solution that serves as a local web server to develop and test PHP projects and Install WordPress Websites. And every project has its own requirements of PHP as well as MySQL version. So you need to set up the specific versions for the project so as to get the desired results. The latest version of PHP 8 has come up with excellent features and improvements. Also make sure to check the PHP version so you can make the necessary changes accordingly. If you are planning to reinstall XAMPP (want to make it compatible with the latest or the previous version of PHP) then you should know how this method works and the steps you need to follow. And the process of reinstalling XAMPP comprises the following:
- phpMyAdmin database back up
- Copying htdocs files
- Copy the php.ini file content (required ones)
- Take back up of the entire XAMPP folder in a new folder.
- Delete older XAMPP (after back up)
Note: Make sure to be very careful while backing up required data and deleting older XAMPP in order to install the new one.
Certainly, you won’t prefer to get caught up in this intricate situation where you’re likely to lose data. And the chances of losing data are greater if you make any mistake. Hence, no room for negligence and unprepared actions.
However, this makes sense to omit this crucial sitch by opting the other feasible solution that will help you update PHP version XAMPP in a few simple steps.
Steps to Update PHP Version in XAMPP
Step 1: First of all you need to download the latest version of PHP. Next you need to extract the folder and copy the php folder from the latest XAMPP. Now go to the current XAMPP, and rename the present PHP folder. Make sure you don’t name it something confusing with simple PHP.
Step 2: If there’s any custom configuration in the php.ini file, then you need to copy and replace the entire content with the new one. However, if you haven’t made any changes to this file then you can skip this step.
Step 3: Now, open the XAMPP server. And click on the ‘Config’ button in the Action column parallel to Apache. Now you can see the configuration files of Apache, open the “httpd-xampp.config” from here.
Step 4: Go to PHP-Module section, and comment the following lines of code and add the new two lines instead.
# # PHP-Module setup # #LoadFile “C:/xampp/php/php5ts.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”
That’s all. Simply restart the XAMPP and you’re good to go.
Steps to Go Back to Lower/Downgrade PHP Version in XAMPP
So, in some cases you may have to go back to the lower PHP version in XAMPP for project requirements. Or simply because you found the previous version better. Whatever, the reason is you can go back to the previous PHP version in XAMPP by following the given below steps:
- Download the XAMPP version you want to downgrade to.
- After the download you need to extract it, and you will find php and apache folder in it.
- Now rename the apache folder that you can find in C:\xampp.
- Restart the apache and MySQL. Now you can check the pho version by using the command “php-v”.
Why Do You Need to Change the PHP Version?
The requirement of the PHP version depend upon various project requirements you are working on. In some cases it might be the requirement of the users. So you may have to upgrade the PHP version. Also, whenever a newer version comes out, the developers and user, make sure to update there current versions to avoid any security risks.
However, I do see many developers still using the older XAMPP version. However, this should not be the case, you must always update the PHP version in XAMPP for best results.
The latest version of PHP offers better performance and functionalities, which is why you must upgrade to the latest version as soon a sit is launched.
Now, you are ready to Change PHP Version in XAMPP
So this is how you can check PHP version in XAMPP and also update PHP version in XAMPP hassle-free. Since PHP is the foundation of any project so you need to keep it updated all the time. While XAMPP, helps you test your project easily. Also if you have and old installation of XAMPP which is disrupted, and mixed with many files, then you can refer to this article to easily update XAMPP.
Also if you are a beginner then it is quite common to set intimidated with the web development process. That is when using a website builder can be of great help. As using a website builder can help you attain the desired results in real-time. With TemplateToaster website builder software you can do so easily without any coding skills. It is a powerful website builder that can help you achieve desired results.
Hopefully, this tutorial helped you learn how to update or change the PHP version in XAMPP, and now you can do it easily. Make sure to share your thoughts and experience in the comments below. Also if you need any help or face any issues, while changing PHP version, then do let me know.