Xampp mac multiple php versions

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.

Multiple PHP Versions and XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Multiple PHP Versions and XAMPP

I am trying to setup a development environment and need PHP 7.4, 8.0 and 8.1. I tried installing different versions of XAMPP in different directories (/xampp, /xampp2 and /xampp3) but had all kinds of issues. I may have been missing something BUT I also do not want to keep multiple copies of the files and databases. I have seen how to install multiple PHP versions like xampp/PHP (orginal install, say 7.4) and xampp/PHP8 and xampp/PHP81. They all say to download the correct version...I know I need thread safe, but do I download the normal thread safe one or the "debug" version. I have never done this before so I am a bit lost.

I am using XDebug and Netbeans on a local Windows 10 laptop in case that matters.

Thanks in Advance.

g2ktcf Posts: 5Joined: 01. January 2022 17:29XAMPP version: 7.4.27Operating System: Windows 10


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Altrea » 02. January 2022 17:44

g2ktcf wrote:I have seen how to install multiple PHP versions like xampp/PHP (orginal install, say 7.4) and xampp/PHP8 and xampp/PHP81. They all say to download the correct version...I know I need thread safe, but do I download the normal thread safe one or the "debug" version.

the normal one
i have written a step by step tutorial years ago which should still work, bit its om german though
https://community.apachefriends.org/f/viewtopic.php?f=4&t=67753#p232615

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers

Xampp mac multiple php versions

Xampp mac multiple php versions

AltreaAF Moderator  Posts: 11655Joined: 17. August 2009 13:05XAMPP version: severalOperating System: Windows 10 Pro x64


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by g2ktcf » 03. January 2022 18:32

Perfect. I got the php versions downloaded. I am trying to get Google to translate (and it seems to work okay). How would you switch between php versions?

g2ktcf Posts: 5Joined: 01. January 2022 17:29XAMPP version: 7.4.27Operating System: Windows 10


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Nobbie » 03. January 2022 19:01

As already mentioned in the links, i would create different VirtualHosts for different PHP Versions. No switch necessary, only different ServerNames.

P.S.. I dont recommend Google for translating. Use deepl.com instead, by far the best engine ever.

Nobbie Posts: 12578Joined: 09. March 2008 13:04


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Altrea » 03. January 2022 19:16

g2ktcf wrote:Perfect. I got the php versions downloaded. I am trying to get Google to translate (and it seems to work okay). How would you switch between php versions?

Switching is pretty easy. All the switch magic happens in the .htaccess file you put into the folder.
So if this settings are not there, the Apache module version would be executed.

You can of cause place this .htaccess directives into a virtualhost too instead. this is up to you. virtualhost changes need a Apache restart, .htaccess Changes not, but they are slower to process.

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers

Xampp mac multiple php versions

Xampp mac multiple php versions

AltreaAF Moderator Posts: 11655Joined: 17. August 2009 13:05XAMPP version: severalOperating System: Windows 10 Pro x64


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by g2ktcf » 03. January 2022 20:00

Everything I have read about virtual hosts makes me think that I need a different htdocs folders for this to work. I need to run the same files on different php versions.

.htaccess Datei im Verzeichnis deiner Wahl mit folgendem Inhalt erstellen

Translates to (for me at least)

Create .htaccess file in the directory of your choice with the following content

Sorry, but folder of your choice is not very specific and I am trying to run THREE different versions of PHP. Do I need a different .htaccess folder for each version of PHP in the that PHP version's folder? I hate to sound stupid but I have no idea what these changes do as I have NEVER been able to understand .htaccess files.

I have C:/xampp/php for 7.4.24 installed as the base
I have C:/xampp/php8 for 8.0.14 files extracted to this folder
I have C:/xampp/php81 for 8.1.1 files extracted to this folder

I have added the following to the very end of my httpd-xampp.conf file.

Code: Select allScriptAlias /php8-cgi/ "C:/xampp/php8/"

    SetEnv PHPRC "C:/xampp/php8"
    AllowOverride None
    Options None
    Require all denied
   
          Require all granted
   

ScriptAlias /php81-cgi/ "C:/xampp/php81/"

    SetEnv PHPRC "C:/xampp/php81"
    AllowOverride None
    Options None
    Require all denied
   
          Require all granted
   

for the .htaccess files, do I create this one for PHP 8.0.14 and put it in the /php8 folder and similarly for the 8.1.1 version?

Code: Select all
    SetHandler application/x-httpd-php-cgi


    Action application/x-httpd-php-cgi "/php8-cgi/php-cgi.exe"

g2ktcf Posts: 5Joined: 01. January 2022 17:29XAMPP version: 7.4.27Operating System: Windows 10


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Altrea » 03. January 2022 22:05

g2ktcf wrote:Everything I have read about virtual hosts makes me think that I need a different htdocs folders for this to work. I need to run the same files on different php versions.

virtualhosts simulate different Apache httpd configurations without the need of installing multiple Apache httpd Servers.
This could be different domain names, which is the main purpose. But you can also configure different PHP implementations for the same DocumentRoot with help of virtualhosts.
virtualhosts are just a container with conditions for when it will activate (by IP, port or domain or a combination of them).
If your webapplication has a setting for the root url, domain or something similar (so if it generates the asset urls by itself) than virtualhosts are maybe not the way to go.

g2ktcf wrote:

.htaccess Datei im Verzeichnis deiner Wahl mit folgendem Inhalt erstellen

Translates to (for me at least)

Create .htaccess file in the directory of your choice with the following content

Sorry, but folder of your choice is not very specific

It cannot be that specific, because it really depends on your needs. In your case if you want to run a full webapplication with different PHP implementations, you surely want to place the .htaccess in your DocumentRoot directly. But if you want for example just one subfolder to be run with a different PHP version this .htaccess needs to be placed in this subfolder.
.htaccess directives will get inherited to subfolders as long as there is no other directive overriding the configurations.

g2ktcf wrote:and I am trying to run THREE different versions of PHP. Do I need a different .htaccess folder for each version of PHP in the that PHP version's folder?

No. Only one .htaccess in the DocumentRoot of your webapplication.

g2ktcf wrote:I hate to sound stupid but I have no idea what these changes do as I have NEVER been able to understand .htaccess files.

There is not much to understand. .htaccess files are a folder based condition to set Apache configuration directives. They get processed on request (instead of settings written in the Apache config files). Not all directives can be set in .htaccess files and you can limit the directives with help of the directive AllowOverride

For the rest of your questions, which i already mentioned: the .htaccess file needs to be placed in the DocumentRoot of your webapplication, not in the PHP folders.

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers

Xampp mac multiple php versions

Xampp mac multiple php versions

AltreaAF Moderator Posts: 11655Joined: 17. August 2009 13:05XAMPP version: severalOperating System: Windows 10 Pro x64


vRe: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Nobbie » 03. January 2022 22:14

g2ktcf wrote:I hate to sound stupid but I have no idea what these changes do as I have NEVER been able to understand .htaccess files.

And why dont you get it? A .htaccess file actually can hold the same configuration lines as a Directory block in httpd.conf. No big difference.

You really should spend some time on working thru Apache documentation, and/or tutorials about configuration. I dont think you have spent lots of time. We cannot replace the need of learning the concecpts of Apache, including all basic configurations. It is not the goal of this forum to replace reading and learning about Apache. We cannot explain every option, every bit and byte of the Apache server. If you like to administrate Apache, you have to learn it. Even if you dont like it. You cannot administrate a webserver without any knowledge. Thats a sophisticated task and we can only help for technical issues, but we do not replace the Apache documentation.

Nobbie Posts: 12578Joined: 09. March 2008 13:04


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by g2ktcf » 04. January 2022 13:11

Altrea,

This is quite helpful and I appreciate you taking time to explain it. I know what .htaccess files do, I just cannot read them, nor do I have time to read through all documentation. My problem was I did not understand how to switch between versions or the relationship between httpd-config and .htaccess.

I am working on a project in xampp/htdocs/store. So I need to put the .htaccess file (actually ADD to the existing .htaccess file) for PHP8 when I need to switch from 7.4? Stopping Apache, modifying that .htaccess file and restarting Apache is no big deal at all. I just do not want to screw this up.

This is a one off for me. I do not have any server control nor do I need it. I am simply developing a extensive new feature for a php based webstore and needed a local host to do testing. The current store works on PHP 7.4 - 8.0 and the new release is for 8.1.

Thanks!
Chris

g2ktcf Posts: 5Joined: 01. January 2022 17:29XAMPP version: 7.4.27Operating System: Windows 10


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by Altrea » 04. January 2022 13:54

g2ktcf wrote:I know what .htaccess files do, I just cannot read them, nor do I have time to read through all documentation.

This problem needs to get solved by you. You need to take your time to learn basics you need to understand, at least the basics you want or need to use.
We might help explaining specific understanding problems, but we claim at least some sort of contribution from you reading and trying to understand the basics you are using.

g2ktcf wrote:I am working on a project in xampp/htdocs/store. So I need to put the .htaccess file (actually ADD to the existing .htaccess file) for PHP8 when I need to switch from 7.4?

yes.

g2ktcf wrote:Stopping Apache, modifying that .htaccess file and restarting Apache is no big deal at all. I just do not want to screw this up.

.htaccess file changes don't need a reastart of Apache.

We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers

Xampp mac multiple php versions

Xampp mac multiple php versions

AltreaAF Moderator Posts: 11655Joined: 17. August 2009 13:05XAMPP version: severalOperating System: Windows 10 Pro x64


Re: Multiple PHP Versions and XAMPP

Xampp mac multiple php versions
by g2ktcf » 04. January 2022 18:23

Works like champ!

Now to see if I can xdebug to work with all three versions.

Xampp mac multiple php versions

And yes, I did read through the Apache documentation for the commands in the file. But I know so little about server configurations, I had no base of information to build off of.

g2ktcf Posts: 5Joined: 01. January 2022 17:29XAMPP version: 7.4.27Operating System: Windows 10



Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 50 guests

How can I run multiple PHP versions in XAMPP?

Setting up support for multiple PHP versions.
Step 1 – Download your new version of PHP. As mentioned above, I use Windows 10. ... .
Step 2 – Extract the files to your XAMPP folder. ... .
Step 3 – Download Fast CGI. ... .
Step 4- Install Fast CGI. ... .
Step 5 – Updating XAMPP Config. ... .
Step 6 – Change the PHP version of a project..

Can I have 2 PHP versions?

Add a PHP Repository By default, Ubuntu 20.04 ships with the PHP version 7.4. So you'll need to add the PHP repository in your system to install the multiple PHP versions. Once the repository is up-to-date, you can proceed to install multiple PHP versions.

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 I run several version of PHP at the same time?

Good!! Yes we can run several versions of php. To do that we must have to check the INSTALL file, if it is included in PHP source distribution.