The answer I gave was adapted from how I have things set up on my Mac (which does use. This is the quickest and most efficient way of doing it, and only requires one XAMPP installation.Įdit : Apparently some people are saying there's no. The OP wants to use XAMPP and tell it which version of PHP to use. You do not need multiple versions of XAMPP, or to dual boot, or use a different machine, or any of the other "solutions" that have suggested convoluted workarounds. Use PHP 7: #LoadModule php5_module c:\php5\libphp5.soLoadModule php7_module c:\php7\libphp7.so Use PHP 5: LoadModule php5_module c:\php5\libphp5.so #LoadModule php7_module c:\php7\libphp7.so Doing this only takes a couple of seconds and you could even comment out a version so "switching" only takes a couple of keystrokes, e.g. There's no GUI switch to be able to do this, you need to edit the. Note, if you don't restart it, the changes won't take effect. You'll have to figure out the correct paths of course - this is just for illustration. LoadModule php7_module c:\php7\libphp7.so In Apache you can do this by finding the file nf and then editing the appropriate line: #XAMPP INSTALL NTS PHP DOWNLOAD#You can download whatever versions of PHP you need and place them into their own directories, e.g.Īll you need to do is tell your web server (Apache) which version of PHP to use, which you do by loading the appropriate module. If you went for option 2, you can see the additional port(8056) listed in your xampp control panel. Restart apache from the xampp control panel. DocumentRoot "C:\xampp\htdocs56" ServerName localhost56 Require all granted SetHandler application/x-httpd-php56-cgi #XAMPP INSTALL NTS PHP CODE#To create a virtualhost (localhost56) on a directory (htdocs56) to use PHP v5.6 on create directory htdocs56 at your desired location andadd localhost56 to your hosts file ( see how),then add the following code to the bottom of the config file ( nf from Step 3). Listen 8056 SetHandler application/x-httpd-php56-cgi Now to to set PHP v5.6 on port 8056, add the following code to the bottom of the config file ( nf from Step 3). SetHandler application/x-httpd-php56-cgi SetHandler application/x-httpd-php56-cgi Just add the following at the bottom of the config file ( nf from Step 3) to set directories. Now you can set directories that will run in PHP 5.6. Note: You can add more versions of PHP to your xampp installation following step 1 to 3 if you want. Put the following settings at the bottom of the file: ScriptAlias /php56 "C:/xampp/php56"Action application/x-httpd-php56-cgi /php56/php-cgi.exe AllowOverride None Options None Require all denied Require all granted Open xampp control panel, click the config button for apache, and click Apache (nf). Then uncomment the following line: extension_dir = "ext"Īlso if the following line exists SetEnv PHPRC "\\path\\to\\xampp\\php"Ĭomment it out with with a leading # (hash character). If the file does not exist, copy php.ini-development to php.ini and open it in notepad. Open the file c:\xampp\php56\php.ini in notepad. The thread safe version does not include php-cgi.exe. #XAMPP INSTALL NTS PHP ARCHIVE#Download the nts (Non Thread Safe) version of the PHP zip archive from php.net (see archive for older versions) and extract the files under c:\xampp\php56. So you have PHP 7 running under xampp, you want to add an older PHP version to it (say PHP 5.6). Run an older PHP version on a virtualhost: You can create a virtualhost like localhost56 to run PHP 5.6 while you can use PHP 7 on localhost. To do this you can set an older PHP version on a different port (say 8056) so when you go to xampp runs PHP 7 and when you go to xampp runs PHP 5.6. Run an older PHP version on a separate port of xampp: Sometimes you may be upgrading an old project to the latest PHP version and at the same time you need to run the same project back and forth between the new PHP version and the old PHP version. Just configure xampp to run an older PHP version for only those project directories. You may have one or two old projects that you intend to run with an older PHP version. Run an older PHP version for only the directory of your old project: This will serve the purpose most of the time. With a single xampp installation, you have 2 options: Why switch between PHP versions when you can use multiple PHP versions at the same time with a single xampp installation?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |