But there are old projects which use functions lượt thích mysql_connect, etc. Those are removed in PHP 7.0.
Bạn đang xem: Browse /xampp windows/5
So, is there a way to lớn easily change PHP versions in XAMPP?
Note: Please don"t suggest to lớn upgrade old project to compatible with new versions because I am not in a position to do it because of that decisions I can"t get as a developer (just an employee).

Why switch between PHP versions when you can use multiple PHP versions at the same time with a single xampp installation?
With a single xampp installation, you have 2 options:Run an older PHP version for only the directory of your old project: This will serve the purpose most of the time. You may have one or two old projects that you intend to run with an older PHP version. Just configure xampp to run an older PHP version for only those project directories.
Run an older PHP version on a separate port of xampp: Sometimes you may be upgrading an old project to the latest PHP version & at the same time you need khổng lồ run the same project back và forth between the new PHP version và the old PHP version. To do this you can mix an older PHP version on a different port (say 8056) so when you go lớn http://localhost/any_project/, xampp runs PHP 7 & when you go khổng lồ http://localhost:8056/any_project/ xampp runs PHP 5.6.
Run an older PHP version on a virtualhost: You can create a virtualhost like localhost56 khổng lồ run PHP 5.6 while you can use PHP 7 on localhost.
Lets phối it up
Step 1: download PHP
So you have PHP 7 running under xampp, you want to showroom an older PHP version to it (say PHP 5.6). Tải về 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:xamppphp56. The thread safe version does not include php-cgi.exe.
Xem thêm: array push php
Step 2: Configure php.ini
Open the tệp tin c:xamppphp56php.ini in notepad. If the tệp tin does not exist, copy php.ini-development khổng lồ php.ini and mở cửa it in notepad. Then uncomment the following line:
extension_dir = "ext"Also if the following line exists in Apache config httpd-xampp.conf
SetEnv PHPRC "\path\to\xampp\php"comment it out with with a leading # (hash character).
Step 3: Configure apache
Open xampp control panel, click the config button for apache, & click Apache (httpd-xampp.conf). A text tệp tin will open. 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 Note: You can add more versions of PHP to lớn your xampp installation following step 1 to 3 if you want.
Step 4 (option 1):
Now you can set directories that will run in PHP 5.6. Just showroom the following at the bottom of the config tệp tin (httpd-xampp.conf from Step 3) to set directories.
SetHandler application/x-httpd-php56-cgi SetHandler application/x-httpd-php56-cgi Step 4 (option 2):
Now khổng lồ to phối PHP v5.6 on port 8056, địa chỉ the following code to lớn the bottom of the config tệp tin (httpd-xampp.conf from Step 3).
Listen 8056 SetHandler application/x-httpd-php56-cgi Step 4 (option 3):
To create a virtualhost (localhost56) on a directory (htdocs56) to use PHP v5.6 on http://localhost56, create directory htdocs56 at your desired location andadd localhost56 to lớn your hosts tệp tin (see how),then địa chỉ the following code to lớn the bottom of the config tệp tin (httpd-xampp.conf from Step 3).
DocumentRoot "C:xampphtdocs56" ServerName localhost56 Require all granted SetHandler application/x-httpd-php56-cgi Finish: Save & Restart Apache
Save và close the config file. Restart apache from the xampp control panel. If you went for option 2, you can see the additional port(8056) listed in your xampp control panel.