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

前端 未结 7 677
南旧
南旧 2020-12-17 20:28

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 d

7条回答
  •  生来不讨喜
    2020-12-17 20:43

    Previous answers didn't work well for me, but there's a rather elegant solution over on the Apache Friends Forum, though it took me a bit to get things working properly. Some highlights:

    • By installing multiple versions of XAMPP, you can get various versions of the PHP CGI module. That said, keep in mind that your config files and databases may need to be restored if you run multiple installers, so backup and plan accordingly.
    • Make sure that those CGIs are allowed to do their thing by adding a block something like this in your httpd-xampp.conf file (I put mine at the end):

      
          Require all granted
          Options +ExecCGI
      
      

      Keep in mind that depending on the version of Apache that XAMPP is using, your syntax may vary a bit.

    • Now find this section in your httpd.conf file and make sure the corresponding Include is uncommented, like so:

      # Virtual hosts
      Include etc/extra/httpd-vhosts.conf
      
    • You can now add entries in your httpd-vhosts.conf file for each version of PHP that you want to use, something like this:

      
          ServerName test54.yourdomain.com
          ....
          ScriptAlias /xampp-bin /Applications/XAMPP/xamppfiles/bin
          
              SetHandler application/x-httpd-php
          
          Action application/x-httpd-php /xampp-bin/php-cgi-5.4.31
          ....
      
      
          ServerName test55.yourdomain.com
          ....
          ScriptAlias /xampp-bin /Applications/XAMPP/xamppfiles/bin
          
              SetHandler application/x-httpd-php
          
          Action application/x-httpd-php /xampp-bin/php-cgi-5.5.35
          ....
      
      ....
      

      (In the version of XAMPP that I use, there also happens to be a symbolic link in that bin directory called simply php-cgi which points to the most recent CGI installed, and I add a block for that, too.)

    • Add corresponding entries to your hosts file, like so:

      127.0.0.1           test54.yourdomain.com
      127.0.0.1           test55.yourdomain.com
      

    That should do it. I love the resulting flexibility, and the fact that the various versions of PHP that I have configured as simply available when I need them.

提交回复
热议问题