Skip to main content

How to upgrade php in xampp

[ratings]Lots of time you need to use multiple version of php for your different project. In this case either you want to install xampp on different port or you can install one xampp and upgrade php. In this article I will demonstrate how you can upgrade php in your xampp server. I will demonstrate the complete process by adding PHP 5.4 with XAMPP. Following is the step by step process of upgrading php in your xampp server. Before trying these steps please take complete backup of your code and database alognwith xampp because any small mistake can lead to the corruption of your regular XAMPP.

Upgrade PHP in XAMPP server

1) Download PHP : If you are using xampp ofcourse you are using windows operating system. So first download your desired version of php binary from http://windows.php.net/download/ website. Be careful while choosing binary. If you are using XAMPP then your webserver is apache. So always download  Thread Safe binary. Also read the compiler suggestion carefully on the windows.php.net site. I will recommend to download zip version.


2) Configure New PHP Version with your xampp: Unzip the downloaded version of the PHP in a separate folder. Please make sure that your new php folder name is not “PHP”. May be you can use filder name as the version name. For example for php 5.4 you can use php54. Copy the new php folder into your xampp folder. Now go to yourxampp/apache/conf/extra folder. Open file httpd-xampp.conf from the folder extra. Change the following variables:

  1. Variable PHPINIDir to be <your xampp folder>/<new version of PHP>
  2. Varaible LoadModule to be <your xampp folder>/<new version of PHP>/php5apache2_2.dll

Save the file httpd-xampp.conf. Restart your XAMPP apache server. If your server get restarted successfully then your server php version is upgraded. You can check the status of your php version by URL http://localhost/xampp/phpinfo.php .

I have recently posted on How to Upgrade to PHP7 in XAMPP and How to install xdebug in XAMPP mac and windows.

 

 

Support Me by Sharing This Article

Ankur Kumar Singh

I am a PHP programmer having some knowledge about Linux. I am always interested in web development and knowledge sharing. I am full time tech evangelist part time human being. :-)

Leave a comment/Ask Question

47 thoughts on “How to upgrade php in xampp

  1. I have followed your step by step process. I got successfully upgraded my php in xampp. Is there any easy way for upgrading php to version php 6 in xampp.

  2. Tried all steps and restarted my XAMPP but my phpinfo() still shows PHP Version 5.2.9 which I had before. What do I do?

    1. You should change also the
      LoadFile “D:/xserver/php/php5ts.dll
      to your new location as
      LoadFile “D:/xserver/php5.5/php5ts.dll

  3. This was a lot easier than I first thought… I wonder if XAMPP will eventually update both Apache and PHP. If you have a Linux-based server, would updating PHP and Apache be simple as doing sudo apt-get update php etc?

  4. Did something change since you created this article?

    I expanded the binary zip for PHP5.4…created a new subdirectory c:/xampp/php54
    and copied the files from the extracted zip into c:/xampp/php54

    I then opened the file httpd-xampp.conf located in: C:\xampp\apache\conf\extra

    Here is what my config file looks like

    LoadFile “C:/xampp/php/php5ts.dll”
    LoadModule php5_module modules/php5apache2_2.dll

    and then at the bottom of the module is:

    PHPINIDir “C:/xampp/php”

    I made the following changes:

    LoadFile “C:/xampp/php54/php5ts.dll”
    LoadModule php5_module modules/php5apache2_2.dll

    PHPINIDir “C:/xampp/php54”

    Apache won’t start!

    I then tried: LoadModule php545/php5_module modules/php5apache2_2.dll

    Apache won’t start

    1. I’m also having exactly the same problem. No. 2 of the instruction is not specific enough and the line is not the same as what is currently on the file.

  5. hey, im having a trouble connecting to apache on xampp after upgrading the php using your method.
    Initially I was able to connect by changing the port from 80 to 8080. How do I do about solving this? Thanks

  6. this is because your mysql dll is not loaded correctly. please configure extension directory and load your desired extension. Also if extension is ok the it could be the isdue of socket.

  7. My XAMPP version is 1.7.3. and PHP version is 5.3.1. I want to upgrade PHP version to 5.5 . I did all steps u said. But apache server won’t start. So can i download XAMPP 1.8.3(with php ver-5.5) and restore htdocs folders? pls suggest me! I’m beginner level of php.

    Thanks,
    Hsu Mon

  8. I’ve followed all steps as you above mentioned to upgrade PHP5.2 to PHP5.5, but my apache is getting not started.
    what should i do? my apache config file code is below.
    Before-
    PHPINIDir “D:/xampp/php”
    LoadModule php5_module “D:/xampp/apache/bin/php5apache2_2.dll”
    After-
    PHPINIDir “D:/xampp/php5.5”
    LoadModule php5_module “D:/xampp/php5.5/php5apache2_2.dll”
    or tried-
    LoadModule “D:/xampp/php5.5/php5apache2_2.dll”
    or tried-
    LoadModule “D:/xampp/php5.5/php5apache2_4.dll”

    I tried it many times but getting not successful result, still apache getting not started. 🙁

  9. Thank you! very nice steps for upgrade PHP version in existing XAMPP version. I have successfully upgrade my PHP version.

    1) LoadFile “D:/xampp/apache/conf/extra/php53/php5ts.dll”
    2) PHPINIDir “D:/xampp/apache/conf/extra/php53”

    Thank you so much!!!

  10. hi, my php version was 5.3.1 and i upgrade it to 5.3.28.it didnt worked for me unitil i changed LoadFile variable too.
    But after that Phpmyadmin dint worked for me and it shows this error:

    phpMyAdmin – Error

    Cannot load mysqli extension. Please check your PHP configuration. – Documentation

    What should i do now?

        1. got the same problem. first apache doesn’t start. then i fixed the problem. but now – phpMyAdmin doesn’t work. i really got no idea how to handle that problem.
          the only way would be to “uninstall” the higher version of php. <- that's the wrost solution for me 😉

  11. I have the same problem as axiom. The upgrade from php 5.3.1 to 5.3.28 worked after I followed the instructions in the article 🙂 but when I tried to go to my site on localhost I got the message “Application Instantiation Error : the MySQL adapter mysqli is not available” 🙁 The phpMyAdmin shows the error “Cannot load mysqli extension”.
    Where is the extension directory folder , is it somewher in the xampp folder ? I can’t find it., help please.

  12. Who knows how to add another version php in xampp 1.8.3? I need add version 5.3, but this tutorial doesn’t work in xampp 1.8.3

  13. Work for me in this way with xamp 1.7.3 and php 5.4.32:

    LoadFile “C:/xampp/php-5.4.32/php5ts.dll”
    LoadModule php5_module C:/xampp/php-5.4.32/php5apache2_2.dll
    PHPINIDir “C:/xampp/php-5.4.32”

    🙂

  14. I have a problem: “Fatal error: Call to undefined function mb_detect_encoding() in E:\Projects\xampp\phpMyAdmin\libraries\php-gettext\gettext.inc on line 177” with PHP 5.5.18.

  15. not work for me because files in php 5.3.8 are not in new version 5.6.x like
    LoadFile “C:/xampp/php/php5ts.dll”
    LoadModule php5_module “C:/xampp/php/php5apache2_2.dll”

  16. If anyone gets a mysqli error after following the original tutorial try the following:
    Stop xampp.
    Open your new php folder and edit php.ini (the php configuration file)
    Look for extension_dir = “C:\xampp\php\ext”.
    As with the original tut, update the php folder in this to your new folder.
    Restart xampp and hopefully it’ll work.

  17. If you are using xampp OFCOURSE you are using windows operating system.???? Many people use XAMPP for Mac!!! Where have you been for the past 10 years?

shares