multiple installs on 1 mac?

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

multiple installs on 1 mac?

Postby spcs5618 » 21. August 2013 09:45

I want to test a site on different php versions.
Is it possible (as mentioned in xampp for windows topic http://community.apachefriends.org/f/viewtopic.php?p=182516 - last post) to install multiple instances of xampp on 1 mac?
spcs5618
 
Posts: 1
Joined: 21. August 2013 09:33
Operating System: OSX

Re: multiple installs on 1 mac?

Postby mwxJudy » 28. January 2016 10:55

That was a long time ago... but you finally made it? I have the same problem. I couldn't find a way to change the default installation folder. Maybe you can help? thanx
mwxJudy
 
Posts: 2
Joined: 28. January 2016 10:31
Operating System: Mac OS

Re: multiple installs on 1 mac?

Postby Nobbie » 28. January 2016 13:19

There is no need to install more than one instance of Xampp. Instead create different VirtualHosts and install PHP as CGI Module. You may apply different PHP Versions in each VirtualHost, for example:

Code: Select all
<VirtualHost *:80/>
        ServerName php5.localhost
         ....
   
        AddHandler php-script .php
        Action php-script /php5/php-cgi
        ScriptAlias /php5 /Applications/path-to-php5
</VirtualHost>
<VirtualHost *:80/>
        ServerName php4.localhost
         ....
   
        AddHandler php-script .php
        Action php-script /php4/php-cgi
        ScriptAlias /php4 /Applications/path-to-php4
</VirtualHost>



You may even apply the same DocumentRoot to these VirtualHost if you want, at runtime only the name of the server (php5.localhost or php4.localhost) decides which PHP Version is used. For example http://php5.localhost/test.php will be executed by PHP5, whereas the same file is executed by PHP4 via http://php4.localhost/test.php

Of course, you may specify different DocumentRoots as well, this is usefull if you have for example two different versions of a tool (lets say WordPress or Joomla) and the one installation should run under PHP5 and the other under PHP4. With the help of VirtualHosts you can even specify more than only two different environments for your projects. And there is no need for a multiple Xampp installation.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: multiple installs on 1 mac?

Postby yodarunamok » 09. November 2017 23:24

I love the solution above. Here are a few bits from my own implementation thereof that will (hopefully) help others down the line:
  • First, an obvious one that bit me: if using the vhosts file, ensure that the corresponding line in httpd.conf is uncommented. :oops:
  • Any directories where a CGI will be running need to be configured to allow this. In my case, this is a bit of code at the bottom of httpd-xampp.conf that looks something like this:
    Code: Select all
    <Directory "/Applications/XAMPP/xamppfiles/bin">
        Require all granted
        Options +ExecCGI
    </Directory>

    This syntax is for Apache 2, and depending on the version of XAMPP that you're running, what you need may be a bit different (https://stackoverflow.com/questions/18392741/apache2-ah01630-client-denied-by-server-configuration#19588786).
  • The handler syntax that I used within my VirtualHost blocks is just a bit different:
    Code: Select all
        ....
        ScriptAlias /xampp-bin /Applications/XAMPP/xamppfiles/bin
        <FilesMatch "\.php$">
            SetHandler application/x-httpd-php
        </FilesMatch>
        Action application/x-httpd-php /xampp-bin/php-cgi-5.4.31
        ....
Again, I hope this is helpful to others, and saves folks some time.
yodarunamok
 
Posts: 1
Joined: 09. November 2017 22:53
XAMPP version: 7.1.10
Operating System: Mac OS X

Re: multiple installs on 1 mac?

Postby mmaranao » 15. October 2018 16:56

Hello,

I'm trying to get multiple PHPs running on my macOS Mojave. The internet has different suggestions but I'm trying to set it up the way it's suggested here.

What I did:
Install XAMPP 7.1.22 in /Applications/XAMPP
Install XAMPP 5.6.38 in /Applications/XAMPP 5.6

I configured apache to use vhosts and is working running PHP 7.1 as the default

Code: Select all
# PHP 7.1 (Default)
<VirtualHost *:80>
    ServerName domain.local
    ServerAlias *.domain.local
    DocumentRoot "/sites"
   
    UseCanonicalName Off
    VirtualDocumentRoot "/sites/%-3+"

    <Directory />
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


Then I wanted to setup to run PHP 5.6 using another vhost but unfortunately it's not working. Can anyone help?

Code: Select all
# PHP 5.6
<VirtualHost *:80>
    ServerName php56.domain.local
    ServerAlias *.php56.domain.local
    DocumentRoot "/php56"

    UseCanonicalName Off
    VirtualDocumentRoot "/php56/%-4+"

    ScriptAlias /php56 "/Applications/XAMPP 5.6/bin"

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>

    Action application/x-httpd-php /php56/php-cgi-5.6.38

    <Directory "/Applications/XAMPP 5.6/xamppfiles/cgi-bin">
        Require all granted
        Options +ExecCGI
    </Directory>
   
    <Directory />
        AllowOverride All
        Require all granted
    </Directory>
   
</VirtualHost>
mmaranao
 
Posts: 1
Joined: 15. October 2018 16:48
XAMPP version: 7.1.22
Operating System: macOS Mojave

Re: multiple installs on 1 mac?

Postby Nikeetaa » 27. January 2021 10:45

Hi, Anyone found any solution for using multiple XAMPP on one machine?
Nikeetaa
 
Posts: 1
Joined: 27. January 2021 10:42
XAMPP version: 5.6.40
Operating System: Mac OS Big Sur

Re: multiple installs on 1 mac?

Postby guti89 » 18. February 2021 08:13

Hey!

Can You tell me, how did you install 2 XAMPP versions on MAC, because when I install new XAMPP version, I cant change installation directory, it is offering only - /Applications/XAMPP. But I have already installed one version of XAMPP in /Applications/XAMPP.

mmaranao wrote:Hello,

I'm trying to get multiple PHPs running on my macOS Mojave. The internet has different suggestions but I'm trying to set it up the way it's suggested here.

What I did:
Install XAMPP 7.1.22 in /Applications/XAMPP
Install XAMPP 5.6.38 in /Applications/XAMPP 5.6

I configured apache to use vhosts and is working running PHP 7.1 as the default

Code: Select all
# PHP 7.1 (Default)
<VirtualHost *:80>
    ServerName domain.local
    ServerAlias *.domain.local
    DocumentRoot "/sites"
   
    UseCanonicalName Off
    VirtualDocumentRoot "/sites/%-3+"

    <Directory />
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


Then I wanted to setup to run PHP 5.6 using another vhost but unfortunately it's not working. Can anyone help?

Code: Select all
# PHP 5.6
<VirtualHost *:80>
    ServerName php56.domain.local
    ServerAlias *.php56.domain.local
    DocumentRoot "/php56"

    UseCanonicalName Off
    VirtualDocumentRoot "/php56/%-4+"

    ScriptAlias /php56 "/Applications/XAMPP 5.6/bin"

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>

    Action application/x-httpd-php /php56/php-cgi-5.6.38

    <Directory "/Applications/XAMPP 5.6/xamppfiles/cgi-bin">
        Require all granted
        Options +ExecCGI
    </Directory>
   
    <Directory />
        AllowOverride All
        Require all granted
    </Directory>
   
</VirtualHost>
guti89
 
Posts: 1
Joined: 18. February 2021 08:09
XAMPP version: 5.6.40
Operating System: MacOS


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 20 guests