How can I install XAMPP to work with different versions of PHP?

I use XAMPP because some of the scripts are buggy when run in WAMP. I use WAMP because it supports different versions of PHP.

But now I would like to streamline it down to just XAMPP so that my web development would be easier to manage.

Is it possible to configure XAMPP to work with more than one version of PHP? Or is it something that I have to look for in an alternative solution?

Note: I'm running on Windows 7.

  • You might want to use WAMPSERVER instead of Xampp. WAMPSEVER contains PHP version switch tray; which is handy. Apr 5, 2016 at 0:14

5 Answers 5


Please note
This answer is not valid for new version of XAMPP.

First, you'll need to stop Apache from XAMPP. Then,

Go go cmd and switch to your XAMPP folder. For example, if your XAMPP folder is in C:\

C:\>cd C:\XAMPP 

In this folder is a file named php-switch.bat, run from the command line. If not, you can also run php-switch.bat directly.

You'll see the version you are now on, and procedure to switch. For example, type 4 to switch PHP 4 then follow the procedure.

php-switch.bat running in the terminal

PHP 4 will install in your XAMPP\PHP directory and successfully switch. then re-enable the Apache.

  • 1
    I can't find php-switch.bat on XAMPP 1.7.3 i installed. Is there specific xamp version that support this? Thanks!
    – Pennf0lio
    Mar 25, 2010 at 15:26
  • Oops. I think the current version does not include php4 anymore apachefriends.org/f/viewtopic.php?f=16&t=33327 .. I think you'll need the older version if you want to switch to v4 Mar 26, 2010 at 4:24
  • 4
    this is no longer valid in newer versions of XAMPP
    – mauris
    Sep 6, 2011 at 14:23
  • 1
    What's no longer valid? Installing PHP4 or swiching versions?
    – AlxVallejo
    Mar 27, 2013 at 13:10
  • 4
    there is no more php-switch.bat in new version
    – Toskan
    Feb 18, 2014 at 10:52

The best method is to change the PHP settings in


to reflect the new version of PHP you want to use

In my case I unpacked PHP5.4 to C:\XAMPPLITE\PHP5.4 and then updated key lines in this file such as:

SetEnv PHPRC "C:\\xampplite\\php5.4"

LoadFile "C:/xampplite/php5.4/php5ts.dll"

PHPINIDir "C:/xampplite/php5.4"

You also need to ensure that the correct version of php5apache2_2.dll is installed

To ensure this I copied the new version of php5apache2_2.dll to the Apache modules directory with a unique name, and then modified the configuration to match that:

copy php5.4\php5apache2_2.dll apache\modules\php5apache2_2-5_4.dll

and in the httpd-xampp.conf file

LoadModule php5_module modules/php5apache2_2-5_4.dll

If your scripts are buggy, they will remain buggy no matter what server packages you switch. If the problem is in your server configs, dig right in and sort it out.

Real hardcore solution would be installing and managing server components (and their configurations) manually. Since I switched away from WAMP to self-administered server installation, I've never again felt any need for prepackaged server solutions.

  • Thanks for the advice! Most on the discussion suggest to use XAMPP as a quick and dirty solution for the script problem. While you have a point, for me it is wise to just switch server (cause it's quick) compare to messing up with the server config that I don't have an idea where to start.
    – Pennf0lio
    Mar 25, 2010 at 15:33
  • Well... Sooner or later you might come to a situation where there's no other option than to delve into configs (like configuring a server through a terminal connection). In case you change your mind - you could try diffing your XAMPP/WAMP/LAMP predefined config files with those of a fresh standalone server installation and than looking up manuals what those differences mean. That's the way I learned what I know now.
    – antichris
    Mar 25, 2010 at 19:02
  • Cool thanks for the Tip. Yeah, I agree with your point But for now I'll just deal with my problem one at a time and will go for the quickest solution. :P I have to many deadlines. I really Appreciate the help :)
    – Pennf0lio
    Mar 25, 2010 at 19:37
  • I asked a similar question but with more functionality over here serverfault.com/questions/121810/… I wanted to upgrade individual elements like apache, mysql, php, and phpmyadmin in my xampp. I am Still looking for a solution to this. If anyone finds a solution then please let me know. Thanks Apr 16, 2010 at 9:47

If you want that feature (meaning, ability to mix and match apache, mysql, and php component builds) and prefer the 3rd Party Bundled AMP Stack Apps, you could look at WAMPServer 2.0 as an option for Windows... Pretty Much every other Bundled AMP Option I've looked at (for Windows, Mac, and Linux) don't allow for swapping out component builds (I'm not including switches of PHP4 and PHP5 as component builds as they were really only offered due to legacy code issues until PHP5 became more backward compatible and PHP4 less abundant).

Most 3rd Party Bundled AMP Stack Apps, especially Unix-based OS builds (Mac & Linux), in order to have the Stack Components within the same directory structure as the "app" root directory, they have to compile each component with specific directives and arguments which ultimately kind of hard-wires some of the folder references and binary signatures into each of the component builds themselves....specifically the mysql and php components because they have library objects that are both shared and required to be specifically referenced and included during the source compile... (and it seems to me that most don't for whatever reason just compile with every optional directive and library included... not sure that would solve the issue or not b/c I have gotten that far with my project to answer that just yet).

One other note, because it is within the same context.... in regards to the comments on using the components autonomous installs vs. the _AMPP stacks, I unfortunately only know what I wrote above because I tried to set up using the 3 autonomous components' source code and tried to have my cake and eat it to.... while never having had any experience dealing with any one of them prior.... so I can say that there are 2 very convincing reasons why Developers do and should use the Stacks for local development environments:

1) if your project is utilizing this technology but isn't explicitly extending function within any one component's core, then most just want to be up an running to be able to work on what they need to work on....and not have to figure out all the configs necessary for the 3 components to seamlessly talk to each other. One could easily struggle for days to learn which directives, modules, libraries, compilation arguments, etc. are needed. If you already know it, great, but don't recommend it to someone who doesn't unless you're gonna do it for them.

2) the bundled stacks are autonomous and isolated from the OS config files, so you can trash your devel environment without severe consequences.... if you want to run scripts that deploy files to the necessary "etc" folder, I don't know about you, but I can make a mistake from time to time and a mistake on the ../XAMPP/etc folder is far less painful then a mistake on the /etc folder.

3) GUI...GUI...GUI... not everyone is a command line Mozart and the AMPP stacks all provide a nice GUI to turn things On and Off to your heart's content. If you want a GUI, you'll gravitate toward the AMPP Stack apps... if you don't care, it all depends on how much weight or stock you put on my points #1 & #2

Anyway, sorry for the Dissertation of "How to Make Someone Yawn", hope someone gets something out of this.


XAMPP now is compiled with multiple versions of PHP. You pick.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.