Categories: WordPress Tutorials

How to Update PHP Version in XAMPP

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 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:

LoadFile “D:/xampp/php/php5ts.dll”

LoadFile "D:/xampp/php/libpq.dll"

LoadModule php5_module “D:/xampp/php/php5apache2_4.dll”

 

New lines of code:

LoadFile "D:/xampp/php/php7ts.dll"

LoadFile "D:/xampp/php/libpq.dll"

LoadModule php7_module "D:/xampp/php/php7apache2_4.dll"

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

Final Words

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 farhan@wpblog.com, I would love to help you out!

Farhan Ayub

Farhan is a community manager at WPblog. He loves to work with WordPress and has a passion for web development. Mostly, he spends his time interacting with the people in the WordPress community. Apart from his work life, Farhan spends his time gaming and playing sports. Feel free to contact him at Farhan[at]wpblog.com.

Share
Published by
Farhan Ayub

Recent Posts

Gutenberg 7.3: Every Thing You Should Know About This Update

Gutenberg just released its second update of 2020 on 22 January and with the help of 159 contributions from 56…

5 hours ago

10 Best Inspirational Ecommerce Website Designs Examples in 2020

Customers don’t care about how much information you have on your website until you have an attractive layout that keeps…

2 days ago

What’s New in WooCommerce 3.9

WooCommerce just released its first update of 2020 on 22 January which brings new enhancements and a more stable version.…

2 days ago

9 Best WordPress RSS Feed Plugins in 2020

Before we get started, I will give a brief introduction about what is WordPress RSS feed and the significance of…

3 days ago

Kinsta Managed WordPress Hosting Detailed Review for 2020

When it comes to running your business, one of the most important commodities you have is time. Many of you…

5 days ago

Best E-commerce Hosting Providers for Online Store (Compared)

In the early 2000s, Amazon stepped into the limelight as an online bookseller. Fast forward two decades, and it’s the…

5 days ago