Post

Working with multiple PHP versions on XAMPP

Download php versions:
https://windows.php.net/downloads/releases/archives/
https://www.php.net/downloads.php
Extract downloaded files to the directory:
C:\xampp\ C:\xampp\php816 or x.x.x
-------------------------------------------------------------
Edit File C++: C:\xampp\apache\conf\extra\httpd-xampp.conf
-------------------------------------------------------------
Important!:
extension_dir="C:\xampp\php\ext" ->>>>>>>>>>
#Change the extension's new php version path#
-------------------------------------------------------------
ScriptAlias /php816/ "C:/xampp/php816/"
Action application/x-httpd-php816-cgi "/php816/php-cgi.exe" ->>>>>>>>>>
#Replace php816 in the code block with the name of the php file you created#
<Directory "C:/xampp/php816">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
SetEnv PHPRC "C:/xampp/php816"
</Directory>
---------------------------------------------------------------
<Directory "C:\xampp\htdocs\users_dokumans\public">| ->>>>>>>>>>
#This directory is the path to the site that will use the new version of PHP#
UnsetEnv PHPRC
<FilesMatch "\.php$">
php_flag engine off
SetHandler application/x-httpd-php816-cgi ->>>>>>>>>>
#Replace this with the folder name containing the new php version#
</FilesMatch>
</Directory>
---------------------------------------------------------------
#Please restart Xampp#
This post is licensed under CC BY 4.0 by the author.