- Download the required version of PHP from https://www.php.net/downloads.php. For PHP7+, you can download the Thread Safe version. For older PHP, try the Non Thread Safe version.
- Create another folder in
C:\xamppfor this version of PHP apart from the existingC:\xampp\php. E.g.,C:\xampp\php74. - Copy the downloaded version’s files into this folder
- Create
php.iniin this folder by duplicatingphp.ini-development - Edit
php.iniand uncomment the lineextension_dir="ext" - Uncomment required extensions in the same
php.ini. Refer to existing PHP version’s ini file to see which extensions to uncomment. For example, uncomment the lineextension=mysqli. - In the XAMPP Control Panel, click Config button for Apache and select
httpd-xampp.conf - Add the following lines to the (end of the) file:
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\project-folder">
<FilesMatch "\.php$">
SetHandler application/x-httpd-php74-cgi
</FilesMatch>
</Directory>
Code language: HTML, XML (xml)
You can add a project-folder entry for each website that needs to use this version of PHP
- In
httpd-xampp.conffile, comment the lineSetEnv PHPRC "\\xampp\\php"(Comment character is #) - Restart Apache
For other methods to configure multiple PHP versions, see this Stack Overflow thread.

Leave a Reply