Can i change php version in xampp?
Why replacing XAMPP PHP version?If you are using XAMPP for PHP development on Windows, there are high chances that you will need to change, upgrade, or even downgrade your XAMPP PHP version to satisfy the compatibility of the PHP package your are developing. Show
Some example cases requiring XAMPP PHP version replacement including:
This tutorial will guide you on how to replace the PHP version of XAMPP on Windows. Tutorial StartsChanging XAMP PHP version: Step by stepHere are the steps to change the primary PHP version in XAMPP on Windows. *We assume that you already have XAMPP running properly. 1. Stop XAMPP Apache processFirst, we need to stop the Apache process on XAMPP. To do that, you can locate the XAMPP icon under Windows notification area. Then, double click the icon: XAMPP icon on notifications areaOn the XAMPP Control Panel dialog, click Stop at the Actions area on Apache to stop the process. The process is stopped when it doesn’t have the light green background anymore. Stopping Apache process on XAMPPIf for some
reasons, the XAMPP icon doesn’t appear on the notification area, you can stop the Apache process using Windows
Like this: Stopping Apache process using taskkill commandThen the Apache process will be stopped. 2. Download new PHP versionNavigate to this official PHP.net Windows download page: https://windows.php.net/download/ On the right panel, pick the PHP version number + thread support type you want to download.
It is recommended to use Apache with FastCGI (fcgi) for handling multiple PHP processes in Windows, however, by default, in XAMPP’s Apache configuration, it uses the native Apache Handler to serve PHP. So, to keep it quick and we assume that people will mostly use default Apache configuration in XAMPP, we will pick the thread safe version. *If you are already using non thread safe version on your XAMPP, just continue to pick the non thread safe version. Okay, so, what to download?After picking the PHP version number and the thread support type that you want, follow this guide to choose what to download:
After seeing the highlighted results, here are the guides to pick the right version:
For example, if we want to pick PHP 5.6.40, thread safe, 64-bit version, this is the one to download: Picking PHP 5.6.40, thread safe, 64-bit versionWe could finally picked the right PHP package to download! Next, let’s get XAMPP PHP version to be updated. 3. Extract new PHP version to XAMPPAfter downloading the PHP package, extract the copy the files into the XAMPP’s We recommend backing up the old 4. Configure XAMPP to run with new PHP versionThe most important step is to configure XAMPP, or more precisely, configure XAMPP’s Apache for it to work with the PHP version we downloaded. Depends on the major PHP version you want to replace, there are different ways to do that to make it work properly. 4.1. Replace the same major PHP version (eg. 7.4.24 to 7.4.25)In most cases, changing PHP with the same major version will not require any Apache configuration. This assumes that the thread support version is still the same, and XAMPP has been running properly. In this case, you can just replace the PHP package files (or backup the old directory and create a new one – like the previous step) into XAMPP’s 4.2. Upgrade/Downgrade major PHP version (eg. 7.4.24 to 8.0.1)To switch major XAMPP PHP version, some Apache configuration of XAMPP has to be adjusted. Fortunately, this is very easy and straight forward to do. *One more time, assuming that the PHP thread support version you are replacing is the same. Open this file in any Windows text editor (Notepad, VSCode, etc. we preferred VSCode):
*Again, you should
backup the file first by copying it to another location. Do not back it up by duplicate the file in the same directory and leave the same 4.2.1. Edit LoadFile on php DLL fileFind this section:
In this section, you will see
various
*The path can be different depends on where XAMPP is installed on your computer. Edit this line, change the DLL file name to the PHP version you already downloaded.
-OR- Downgrading from PHP 7 to PHP 5:
4.2.2. Edit LoadModule on Apache DLL fileThen, the next edit is the line nearby with
*The path will be different based on your system. Edit this line, replace all The later part is the DLL file to edit based on version, with the syntax of For example, downgrading from PHP 7 to 5:
-OR- upgrading from PHP 7 to 8:
4.2.3. Edit IfModuleLook up all the
Edit them all to:
That’s all we need to edit on this file. Save the file and move on to the next step. 5. Verify that everything worksTo check if the adjustments are fully working, start Apache in XAMPP. Open the XAMPP Control Panel by the notification bar icon, or by the Next, create a PHP file inside XAMPP’s
Save the file, and open it on the browser using localhost URL. Check if the PHP version is updated properly. If yes, congratulation! You have done all of the steps properly to change XAMPP PHP version on Windows. If there are errors showing, double check the steps and file adjustments to make sure everything is applied correctly. We are going to release an article on how to debug PHP errors on XAMPP soon. This tutorial is now over. Thanks for reading and hopefully it’s helpful for you. Also with the PHP on Windows series
How do I change my PHP version?Changing the PHP version. Navigate to the Manage Websites page.. Click the Manage button to the right of your domain.. Under the PHP section, click the Modify icon.. Choose a version of PHP from the dropdown menu.. Scroll down and click the Change PHP Version button to save your changes.. How can I use older version of PHP in XAMPP?Steps to change port:. Change the config file for the MySQL in “my. ini” file.. Change the port to 3307.. Run the code: PHP. ... . Save the above code in “htdocs” folder of the XAMPP folder for the new and older version.. Save in “htdocs” folder of the XAMPP folder.. Similarly with XAMPP_1_8_2.. Can I downgrade my PHP version?If you'd like to downgrade your PHP installation you can do so without interfering with the path to your installation and can simply overwrite older files. This process will overwrite your current PHP.
Can you have multiple PHP versions?So you'll need to add the PHP repository in your system to install the multiple PHP versions. Once the repository is up-to-date, you can proceed to install multiple PHP versions.
|