Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    505
    Plugin Contributions
    0

    Default XAMPP and Different PHP Versions

    This is not a question! I recently had been trying to get XAMPP as my local host to use different versions of PHP for testing. While it was not easy to get the information, I finally got it to work. I found all kinds of different instructions all over the net. Some use virtual servers and that is an option. This seemed to be the best for my needs. Some input from the Apache forum was critical to get this to work. I guess I was being annoying as they wanted me to go learn all about servers and server configurations! I am not a server guy and all I can show you is what I have working. PLEASE do not ask me to explain what is in the files. I have read through some of the documentation but I am still sort of lost. I am sure that there are some folks here on the forum that can explain this better. I am also trying to get Xdebug to work with all three versions as well. That is a work in progress. If you are interested, please keep reading.

    First off, install the version of XAMPP you want to use as a base install. I have 7.4.25 as my installed base to xampp\

    Next under you XAMPP create two new folders, in my case xampp/php8 (8.0.10 is the actual one) and xampp/php81v (8.1.1 is the actual version). Your base install version (7.4.25 for me) will be under xampp\php). Go to php.net and download the Windows version of that PHP file. Make sure you get the regular zip file as I cannot vouch for the others. I was told that the "debug" version was not the correct one. Unzip the PHP versions into the correct folder.

    Under the XAMPP control panel, open httd-xampp.config file and add the following to the bottom of the file. Note how the versions are shown. you need to make four changes for each version as yours may be different. I went forward but I am told that you can go backwards to older versions if needed.

    Code:
    ScriptAlias /php8-cgi/ "C:/xampp/php8/"
    <Directory "C:/xampp/php8">
        SetEnv PHPRC "C:/xampp/php8"
        AllowOverride None
        Options None
        Require all denied
        <Files "php-cgi.exe">
              Require all granted
        </Files>
    </Directory>
    
    ScriptAlias /php81-cgi/ "C:/xampp/php81/"
    <Directory "C:/xampp/php81">
        SetEnv PHPRC "C:/xampp/php81"
        AllowOverride None
        Options None
        Require all denied
        <Files "php-cgi.exe">
              Require all granted
        </Files>
    </Directory>
    create a new .htaccess file for each version. The trick is to set the php version by using the .htaccess so you copy the correct .htaccess file to the store folder where you want to use the PHP version. I actually made two different files and named them PHP8htaccess and PHP81htaccess. All I have to do to change PHP versions is to rename either file to .htaccess.

    for PHP 8.0.1, I used
    Code:
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php-cgi
    </FilesMatch>
    
    <IfModule actions_module>
        Action application/x-httpd-php-cgi "/php8-cgi/php-cgi.exe"
    </IfModule>
    and for 8.1.1, I used

    Code:
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php-cgi
    </FilesMatch>
    
    <IfModule actions_module>
        Action application/x-httpd-php-cgi "/php81-cgi/php-cgi.exe"
    </IfModule>

  2. #2
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: XAMPP and Different PHP Versions

    I appreciate the effort/time involved and altruistic motives for your post. Multiple times I have considered doing the same, but didn't.
    This sort of information is invaluable and liable to changes/be tweaked so maybe you would consider putting it on Github so others may be tempted to add their particular experiences/problems/solutions.

    Personally I have moved from Xampp to Laragon in which it is so easy to add other versions (Apache, mysql, maria, php) that if you have a look at it you may get a bit angry at how much time you have spent on Xampp, but you have learnt a lot!
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  3. #3
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    505
    Plugin Contributions
    0

    Default Re: XAMPP and Different PHP Versions

    where would I put this on Github? I am still a newb.....

    Teach me Obi-wan!

  4. #4
    Join Date
    Mar 2008
    Location
    Belgium
    Posts
    115
    Plugin Contributions
    6

    Default Re: XAMPP and Different PHP Versions

    Mine just work fine by installing them in:
    xampp_7_4
    and
    xampp_8_0

    A shortcut for each on the desktop screen and so far so good.

  5. #5
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    505
    Plugin Contributions
    0

    Default Re: XAMPP and Different PHP Versions

    Quote Originally Posted by Philibel View Post
    Mine just work fine by installing them in:
    xampp_7_4
    and
    xampp_8_0

    A shortcut for each on the desktop screen and so far so good.
    but then you need separate htdocs folders. Xdebug will not work like this, at least from my experience. I can change PHP versions on the fly without even restarting Apache.

  6. #6
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: XAMPP and Different PHP Versions

    where would I put this on Github? I am still a newb.....
    Create an account on GitHub, get Gitkraken, watch all their video tutorials and make/play with a test repository.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: XAMPP and Different PHP Versions

    FWIW, I've been using the port-based solution identified in this (https://stackoverflow.com/questions/...sions-in-xampp) stackoverflow posting.

    That way, I can access a site that 'needs' PHP 5.6 on localhost:8056/something and can run the zc157c upgrade of that site on localhost:8080/something.

  8. #8
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    505
    Plugin Contributions
    0

    Default Re: XAMPP and Different PHP Versions

    Quote Originally Posted by lat9 View Post
    FWIW, I've been using the port-based solution identified in this (https://stackoverflow.com/questions/...sions-in-xampp) stackoverflow posting.

    That way, I can access a site that 'needs' PHP 5.6 on localhost:8056/something and can run the zc157c upgrade of that site on localhost:8080/something.
    I saw that one and I think it is a perfect answer as well. I did not know if the port settings would cause problems with Netbeans & Xdebug. I do not have an answer for this so I chose a path! There may not be any problem at all.

    Your solution could get memorized in the browsers, right? I sort of WANTED to make a larger effort to make sure I was on the right version. I would end up thinking I was on 7.4 and actually be on 8.0. Again, my fears may be overstated.

  9. #9
    Join Date
    Mar 2008
    Location
    Belgium
    Posts
    115
    Plugin Contributions
    6

    Default Re: XAMPP and Different PHP Versions

    Quote Originally Posted by g2ktcf View Post
    Your solution could get memorized in the browsers, right?
    Perhaps use for each php-version a different browser? Chrome, Edge, Firefox or Opera to separate the cache memories.

  10. #10
    Join Date
    Feb 2011
    Location
    Lumberton, TX
    Posts
    505
    Plugin Contributions
    0

    Default Re: XAMPP and Different PHP Versions

    Quote Originally Posted by Philibel View Post
    Perhaps use for each php-version a different browser? Chrome, Edge, Firefox or Opera to separate the cache memories.
    you still need to check dev code on all browsers for compatibility, wouldn't you? I like my chosen method because I know, I must "select" a version each time I test something...AND I am testing the same code each time. There are other ways to do this as lat9 mentioned. So ymmv.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Upcoming versions - 1.5.3 and 1.6.0 -- compatible with PHP 5.4, 5.5, 5.6
    By DrByte in forum Zen Cart Release Announcements
    Replies: 0
    Last Post: 24 May 2014, 02:32 AM
  2. Working locally with two versions (or 2 instances) of XAMPP
    By tryphon in forum General Questions
    Replies: 3
    Last Post: 17 May 2010, 08:02 PM
  3. What versions of xampp to use?
    By jshurbet in forum Installing on a Windows Server
    Replies: 5
    Last Post: 25 Feb 2010, 06:27 AM
  4. XAMPP and PHP cURL in php.ini
    By Jack28 in forum General Questions
    Replies: 2
    Last Post: 21 Dec 2009, 02:46 AM
  5. Replies: 3
    Last Post: 3 Mar 2009, 03:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR