XAMP with diferent versions of PHP

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

XAMP with diferent versions of PHP

Postby ReggFulton » 10. February 2021 09:01

Hi. I am trying to run three versions of PHP on a single xamp installation.
I need PHP5.6 as there is an older intrasite that uses a library not compatible with newer versions.
I need PHP7.4 as this is what is currently running our public site and I need a staging area to create a duplicate of the site for testing.
I also want PHP8. All new programing will be tested here.
I almost got it working.
What I've done:
Installed latest version of xamp with PHP8.02
Downloaded php5.6 and 7.4 and created their own folder under xamp.

The setup allows for a directory to be run on a specific version of PHP
E.G. I have a Reports folder that needs to run on PHP5.6, the wordpress folder should be on 7.4 and everything else on 8.

After some online searching, I added the following to the Apache(httpd-xamp.conf) file:
Code: Select all
ScriptAlias /php56 "C:/xampp/php56"
Action application/x-httpd-php56-cgi /php56/php-cgi.exe
<Directory "C:/xampp/php56">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

<Directory "C:/xampp/htdocs/Reports">
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php56-cgi
    </FilesMatch>
</Directory>

ScriptAlias /php74 "C:/xampp/php74"
Action application/x-httpd-php74-cgi /php74/php-cgi.exe
<Directory "C:/xampp/php74">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

<Directory "C:/xampp/htdocs/wordpress">
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php74-cgi
    </FilesMatch>
</Directory>


I tried to run the Reports folder, Error log shows it couldn't find the extensions, but it was looking for php\ext not php56\ext.

I then changed the following enrty at the top of the file:
Code: Select all
SetEnv PHPRC "\\xampp\\php"

to:
Code: Select all
SetEnv PHPRC "\\xampp\\php56"


This allowed both PHP5.6 and 8 folders to work but not PHP7.4

If I change it to:
Code: Select all
SetEnv PHPRC "\\xampp\\php74"

then 7.4 and 8 works but not the 5.6 folder.

Any way I can get all three version to work?
ReggFulton
 
Posts: 1
Joined: 10. February 2021 08:34
XAMPP version: 3.2.4
Operating System: windows 10

Re: XAMP with diferent versions of PHP

Postby Altrea » 10. February 2021 11:24

Hi,

you can follow my german step by step tutorial on how to add another php version to the existing XAMPP installation.
This uses nearly the same approach except the php switch is done in a .htaccess file.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 10727
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 75 guests