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: 9761
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


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 7 guests