WordPress Managed Hosting - 40% Off For 4 Months - Coupon Code: BFCM2021 Avail Now

How to Update PHP Version in XAMPP

Moeez — December 4, 2019 5 Minutes Read

Many web developers, especially beginners, have a common question “How to update PHP version in XAMPP?”. After getting a lot of queries on the topic, we decided to write a short and simple tutorial on how you can easily update PHP version in Windows XAMPP.

XAMPP plays a significant role for web developers and it’s one of the most popular stacks that developers use to build and test websites locally. What makes it popular among developers is that even if something goes wrong with the code, it doesn’t affect the live web platform.

Working on the localhost is indeed a good practice to boost your web development skills and it is also common among WordPress developers. However, most users are left asking “How to change PHP version in XAMPP?” Or “How to upgrade PHP version in XAMPP?”.

Related Posts:


In this tutorial, I will show you how easily you can update your PHP version in XAMPP through 4 simple steps. However, before embarking on the process you need to know why it is important to upgrade PHP version on XAMPP and when is the right time to change the PHP version.

Reasons to Upgrade PHP Version in XAMPP

The PHP version requirements often vary with specifications of the project you are working on. Sometimes it’s the users who demand a newer PHP version which can compel you to update it. In most cases, whenever a new PHP version is rolled out, users and developers waste no time in updating their current versions to avoid security threats.

As a member of various developers’ community, I often see many developers still using the older version of XAMPP(i.e. XAMPP 3.2.1 or older) that runs on PHP 5. What they are mostly concerned with is updating the PHP version in their current XAMPP without reinstalling it all together.

PHP 7 offers an advanced set of functionalities as compared to PHP 5, which are all reasons why you should update your PHP version as soon as it is launched. To check the PHP version, type http://localhost/phpinfo.php in your browser and a new screen will appear with the PHP version information.

Let’s look at why PHP 7 has the upper hand over PHP 5.

  1. For starters, PHP 7 is faster than any other version available, including PHP 5. Suppose, you have written a PHP code in PHP 5, if you run the same code on PHP 7, you will see a significant upgrade in PHP performance.
  2. PHP 7 provides ease in error handling as compared to other older versions of PHP. If you are using PHP 5 then you would know how hard it is to handle fatal errors.
  3. PHP 7 supports anonymous class, a feature that is not available in any of the older PHP versions. Anonymous class is used to speed up the execution time which is common in other OOP languages like JAVA, C#, etc.
  4. PHP 7 supports 64 bit (large) files which you can run on 64 bit OS architecture. This feature is also not available on PHP 5.
  5. PHP 7 also includes null coalescing operators, accurate type declarations and many advanced features.

Now that we have understood how important it is to update your PHP version in XAMPP, let’s move forward and see how you can update your PHP version in 4 simple steps.

How to Update PHP Version in Windows XAMPP in 4 Simple Steps

The beauty of the XAMPP lies in the fact that it’s a development server, not a production server. This means that you can play with its configuration and make simple changes like changing its PHP version without affecting your live application.

Note: I would recommend that before you upgrade PHP version in XAMPP, make a backup for your site files or project files. ALWAYS MAKE A BACKUP FOR DATA.

Updating PHP version in XAMPP is simple. All you need to do is follow these 4 simple steps.

Step 1: Download the latest version of PHP (i.e. PHP 7.x)

First, you need to click here to download the latest binary version of PHP. Make sure you download the Thread Safe Zip file depending upon your Windows version( x86 for 32-bit and x64 for 64-bit ), as you can see in the image below.

In the above image, you can see that I have downloaded the VC14x64 Thread Safe because my windows version is 64-bit.

Step 2: Extract the Zip File and Create PHP Folder

Next, create a new folder in your Windows desktop and name it PHP. Then, extract the Zip file into that new folder(i.e. PHP).

Step 3: Rename the Old PHP Folder

Next, go to XAMPP folder and select the php folder and rename it with something like php_5 and then paste the extracted-new-php folder on XAMPP directory. You can see in the below image, how I did this.

Step 4: Configuring Apache Server

Next in the process is to configure the Apache server and for this, you need to open your XAMPP control panel then click on Apache Config > Apache (httpd-xampp.conf).

Then, an httpd-xampp.config file will open on your screen. Next, in the PHP-Module setup, paste the new lines of code and remove the previous lines of code like as shown in the below image.

Previous lines of code:

 

New lines of code:

Then, save the file and restart the XAMPP server. Tada! It’s done.

Final Words

Updating your PHP version is an absolute must if you want your WordPress site to run smoothly. The article covered how you can update your PHP version manually but there are WordPress maintenance services that take care of such tasks for you so that you can focus on more important things like your business.

I hope this tutorial helped you to learn “How to update PHP version in XAMPP”. If you need any support or if you face any problem while updating XAMPP PHP version don’t hesitate to ping me in the comments section or email me at [email protected], I would love to help you out!

Create Faster WordPress Websites!

Free eBook on WordPress Performance right in your inbox.


    Create Faster WordPress Websites!

    Free eBook on WordPress Performance right in your inbox.

      Moeez is ‘The’ blogger in charge of WPblog. He loves to interact and learn about WordPress with people in the WordPress community. Outside his work life, Moeez spends time hanging out with his friends, playing Xbox and watching football on the weekends. You can get in touch with him at moeez[at]wpblog.com.

      THERE'S MORE TO READ

      Newsletter

        WordPress Help Zone - Ultimate WordPress Pit-Stop

        Learning WordPress? Or are you expert enough to help others? Join our WP Facebook group!