How to Update PHP Version on XAMPP (Windows)?

Being a web developer myself, XAMPP is probably one of the software that I use mostly on my Windows computer. I will not go into details to explain why I use XAMPP and why you should consider using it too. While it took me a while to figure out how to update the PHP version, I though it will be helpful to share my experience and make your job easier and save you lot of time on this task. This article is dedicated to show you different options on how to update the PHP version on XAMPP Windows and fix any problem that may come along.

Why You Should Update XAMPP PHP Version?

Just like with any other software, with PHP it is also highly recommended to use the latest version. The new PHP7 version has lots of improvements, compared to the old PHP5. PHP7 uses half of the memory and its performance has been improved significantly. Here are some other benefits of using PHP7:

  • PHP 7 is almost twice as fast as lower version of PHP
  • Low memory usage (up to 50%)
  • Facilitates Error Handling
  • 64-Bit Windows Systems Support
  • New Spaceship and Null Coalescing Operators
  • Enables Accurate Type Declarations
  • Add Anonymous Classes
  • Facilitates Imports From the Same Namespace
  • Introducing null coalescing & Spaceship operator and more

On the other hand PHP5 version will not be supported for much longer. For instance, Joomla 4 will be compatible only with server that are using at least PHP7 version. These are only couple of reasons, but you get the point.

Update PHP version on Windows XAMPP

If you are running an older version of XAMPP (3.2.1 or older), most likely you are still using PHP5. Here are couple of options on how to upgrade old PHP5 version to PHP7.

  1. Download the latest PHP version that is compatible with your Windows (x86 or x64)

  2. Extract files to a folder named php

  3. Go to your XAMPP installation directory and rename the old php folder (something like php_5)

  4. Copy the recently extracted php folder to your XAMPP installation folder

  5. Open up the XAMPP Control Panel and configure Apache

  6. Click on Config button next to Apache module and choose Apache (httpd-xampp.conf)

    update php windows xampp apache httpd

  7. Replace all php5 with php7 text and save the file

  8. Restart Apache server!

What if the Apache server does not start? You might get the following error message on your XAMPP Control Panel:

[Apache]     Status change detected: running

[Apache]     Status change detected: stopped

[Apache]     Error: Apache shutdown unexpectedly.

[Apache]     This may be due to a blocked port, missing dependencies,

[Apache]     improper privileges, a crash, or a shutdown by another method.

[Apache]     Press the Logs button to view error logs and check

[Apache]     the Windows Event Viewer for more clues

[Apache]     If you need more help, copy and post this

[Apache]     entire log window on the forums

If so, please do the following:

  1. In the XAMPP Control Panel click the Config button next to Apache module

  2. Choose Apache (httpd.conf)

    xampp edit apache httpd conf

  3. Find and replace the following lines:

    Listen 80

    to

    Listen 8080

    ServerName localhost:80

    to

    ServerName localhost:8080

  4. Save and close the httpd.conf file

  5. Edit the httpd-ssl.conf file by clicking the Apache (http-ssl.conf)

    xampp edit apche httpd ssl conf

  6. Find and replace the following lines:

    Listen 443

    to

    Listen 4443

    <VirtualHost _default_:443>

    to

    <VirtualHost _default_:4443>

    ServerName www.example.com:443

    to

    ServerName www.example.com:4443

  7. Save and close the httpd-ssl.conf file

  8. Restart Apache server

If you did everything right, the Apache server should start.

At this point one more error could stop you using the XAMPP Apache server:

Missing DLL Problem with XAMPP

error api ms win crt runtime l1 1 0 dll

The program can’t start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

This error is due to outdated Microsoft Visual C++ software. The error could still persist, even though you might have this software installed to your computer.

Here is what you can do:

  1. Download the latest version of Microsoft Visual C++

  2. Uninstall the old version from your computer: Start > Control Panel > Programs Uninstall a Program

  3. Restart your computer

  4. Install the new version that you recently downloaded

  5. Restart your computer again

  6. Launch the XAMPP Control Panel and start the Apache server – the .dll error should not pop up anymore

Install XAMPP 3.2.2

If none of the above methods work, I suggest installing the latest version of XAMPP. The latest version of XAMPP (3.2.2) comes with PHP7 included, so you don’t have to mess with all the above problems. But be careful, not to overwrite your old files, because you might lose all your projects, files and databases. Here is an easy to follow step-by-step guide on how to install the new XAMPP and transfer your projects over:

  1. Go to AppacheFrineds.org and download the version that you need

    download xampp latest version

  2. Run the installation and choose a different destination folder for it – if your old XAMPP version is installed to C:/xampp/ folder, install the new version to C:/newxampp/

  3. After successful installation transfer the C:/xampp/htdocs/ folder to C:/newxampp/htdocs/ – this will transfer all of your project files to the new installation

  4. Also transfer the C:/xampp/mysql/data/ to C:/xampp/mysql/data/ – this will transfer all database information to the new installation

  5. Open the new XAMPP Control Panel v3.2.2 – and start Apache and MySQL

  6. Now check the php version http://localhost/phpinfo.php – this PHP file should contain the following line:

    <?php phpinfo(); ?>

    php info version 7 2 6

  7. Start using the power of PHP7!

Wrapping it up

I really hope this article has helped you. If you are still having difficulties, please let us know in the comments and will try to answer your queries and find a solution to your problem. Happy coding!

avatar

David Cross

David is the chief editor at WebHostingMedia right from the beginning. He has a great passion for building and managing websites and creating helpful content. He is also interested in programming - currently learning python.