Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install multiple XAMPP versions OR Multiple PHP versions on MAC OS X 10.7 Lion

Tags:

php

xampp

I need to do some work on a legacy system that requires PHP 5.2

I already have XAMP 1.7.3 installed but this version has PHP 5.3.

Since this a work I might do for a couple of times in the next months, I was thinking about installing a XAMP version that runs PHP 5.2 At the same time I'm involved into some work that requires me to use PHP 5.3, so I just can`t uninstall my current XAMP version and install one that uses PHP 5.2

On XAMPP Download Website it's pretty clear that on installing any XAMPP version it will remove previous one. I've done some research but couldn't find a way to get around this.

I managed to find phpswitch under /Applications/XAMPP/xamppfiles/bin/ and using it's list action showed me that I only have PHP 5.3.1 installed and active. I tried to figured out on how to download/install/activate PHP 5.2 using phpswitch but had no success.

So what I'm looking for is a way to install multiple XAMPP or installing PHP 5.2 and activating it for XAMPP (either through phpswitch or another way)

like image 823
Helton Valentini Avatar asked Sep 19 '12 18:09

Helton Valentini


People also ask

Can I install 2 XAMPP versions?

As two different versions of XAMPP cannot run on the same port, we need to change to the port. Steps to change the port for the XAMPP1_8_2: Open the file HTTP CONF file > change the port from the 80 to 8080. After changing the port click on save and exit.

Can you run multiple versions of PHP at the same time?

Together, you can use Apache and PHP-FPM to host multiple PHP web-applications, each using a different version of PHP, all on the same server, and all at the same time.


3 Answers

You could always use VirtualBox (or similar) to create an instance with 5.2 on it and then when you're done with old work, just dump the VB instance with no ill affect on your current system.

like image 27
sfell77 Avatar answered Sep 28 '22 05:09

sfell77


You can install parallel versions of XAMPP - one for each major version of PHP. Just don't run both at the same time.

Install each instance of XAMPP in it's own folder.

I do this under a folder called

XAMPPInstalls/XAMPP182-PHP54 /XAMPP183-PHP55/

In each XAMPP folder, you'll find an .exe to launch the controller for that specific XAMPP stack. I've created shortcuts to those, renamed them to 'XAMPP182-ControlPanel' and 'XAMPP183-ControlPanel' and placed those on my desktop.

When I need to run local site on PHP5.4, I click on XAMPP182-ControlPanel and fire up the Apache and MySQL servers.

When I need to switch a local site to PHP5.5, I click on XAMPP182-ControlPanel and shut down the Apache and MySQL servers, then I click XAMPP182-ControlPanel and fire up the Apache and MySQL servers in that stack.

This takes just a few seconds.

Also, I use 'soft-linking' so that I do all my configuration for my local web sites in one folder - then create a 'junction' (i.e. a source folder that replicates itself in the Apache configs for each XAMPP stack).

There is a really good article on this called 'Practical Development 2: Working Environment' by Marco Dings in the Joomla! Community Magazine on how to set up your work environment to run multiple local XAMPP installs, multiple local web sites using 'name based hosting,' and how to keep it all organized.

I don't use Ding's set-up exactly - I've tweaked to get my local web projects even more organized and streamlined - but my set-up is based on Ding's approach.

NOTE: The article, while in the Joomla! Community Magazine, is not specific to Joomla!, so you can use this set-up for whatever PHP/Apache/MySQL projects you are working on.

Now there are lots of ways to do this (e.g. using Oracle's VM Virtual Box), but that might be overkill unless you need to replicate your remote hosting environment 'exactly.' For example, if you are running a 'dedicated host' and want to closely replicate dedicated host's environment and set up as closely as possible, then you'd go with VM Virtual Box Set-Up - this allows you to run multiple VM's (i.e. different set-ups) and then clone the exact set-up to your live server. Again, overkill if most of your projects are going to 'shared hosting' environments as you don't have much control over the set-up anyways.

Parallel installation of multiple instance of XAMPP is much much much simpler and you can set it up as per Ding's article. It should cover your requirements.

I've mentioned Oracle VM VirtualBox because you should at least know about it as an option.

like image 119
NivF007 Avatar answered Sep 28 '22 04:09

NivF007


You have a couple of options. Either use a virtual box to run virtual environments: one with PHP 5.2 and another with PHP 5.3. Or, if you're comfortable with installing PHP you could install the various version of PHP you need, and set up a symbolic link to the version you want to use at that time.

like image 44
Martin Bean Avatar answered Sep 28 '22 04:09

Martin Bean