Run multiple versions of PHP in XAMPP

Add RSS feed to Reader and sync to Readwise.

  1. Download the required version of PHP from For PHP7+, you can download the Thread Safe version. For older PHP, try the Non Thread Safe version.
  2. Create another folder in C:\xampp for this version of PHP apart from the existing C:\xampp\php. E.g., C:\xampp\php74.
  3. Copy the downloaded version’s files into this folder
  4. Create php.ini in this folder by duplicating php.ini-development
  5. Edit php.ini and uncomment the line extension_dir="ext"
  6. 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 line extension=mysqli.
  7. In the XAMPP Control Panel, click Config button for Apache and select httpd-xampp.conf
  8. 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

<Directory "C:\xampp\htdocs\project-folder">
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php74-cgi
Code language: HTML, XML (xml)

You can add a project-folder entry for each website that needs to use this version of PHP

  1. In httpd-xampp.conf file, comment the line SetEnv PHPRC "\\xampp\\php" (Comment character is #)
  2. Restart Apache

For other methods to configure multiple PHP versions, see this Stack Overflow thread.


Leave a Reply

Your email address will not be published. Required fields are marked *