Skip to content

Multiple PHP versions on Windows: one site, one FastCGI version

Verified 2 min read

Run PHP 8.3 and 8.4 side by side on IIS with separate directories, FastCGI applications, site-level handlers and per-version php.ini.

Tested onStandard / Datacenter · Build 26100.33650 · x64
E1
Build
26100.33650
Edition
Standard / Datacenter
Architecture
x64
Support
Documentation (E1)
Evidence
E1Official documentation
Verified
2026-10-29
Test machine
PHP 8.4.27 FastCGI verified on VM 361 Windows 11 26H2; PHP 8.3 side-by-side pattern E1
Page type
Method

PHP version is selected by the handler’s scriptProcessor, not by the application pool. To run 8.3 and 8.4 side by side:

  1. Install each NTS build in its own directory (C:\PHP\8.3, C:\PHP\8.4).
  2. Each has its own php.ini.
  3. Register each php-cgi.exe as a FastCGI application.
  4. Give each site a site-level *.php handler pointing at that version.
  5. Keep app pools separate for isolation, but do not expect the pool to choose PHP.
C:\PHP\8.3\php-cgi.exe
C:\PHP\8.3\php.ini
C:\PHP\8.4\php-cgi.exe
C:\PHP\8.4\php.ini

Do not put both versions in one folder or share ext. A missing/incorrect extension_dir is the usual “extension not found” cause.

Terminal window
Import-Module WebAdministration
Add-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/fastCgi' `
-Value @{ fullPath = 'C:\PHP\8.3\php-cgi.exe' }
Add-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' `
-Filter 'system.webServer/fastCgi' `
-Value @{ fullPath = 'C:\PHP\8.4\php-cgi.exe' }

Both can exist; only the handler decides which one a request uses.

If the server already has a global PHP_via_FastCGI pointing at 8.4, a PHP 8.3 site can remove it and add its own:

<configuration>
<system.webServer>
<handlers>
<remove name="PHP_via_FastCGI" />
<add name="PHP83_via_FastCGI"
path="*.php" verb="*"
modules="FastCgiModule"
scriptProcessor="C:\PHP\8.3\php-cgi.exe"
resourceType="Either" />
</handlers>
</system.webServer>
</configuration>

Do not <clear /> all handlers; that removes static content and breaks CSS/images. Remove only the PHP handler you are replacing.

The 8.4 site can keep the global handler or define PHP84_via_FastCGI explicitly. Explicitness is easier to audit.

Each version needs its own settings:

; C:\PHP\8.3\php.ini
cgi.fix_pathinfo=0
fastcgi.impersonate=1
date.timezone=UTC
extension_dir="ext"
expose_php=Off

If PHP loads the wrong ini, check php --ini / a phpinfo page. PHPRC can force a directory, but per-version directories + php-cgi next to its ini are simpler.

Terminal window
& C:\PHP\8.3\php-cgi.exe -v
& C:\PHP\8.4\php-cgi.exe -v
Get-WebConfiguration -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter 'system.webServer/fastCgi' |
Select-Object -ExpandProperty Collection

Create a site-specific info.php and confirm PHP Version and Loaded Configuration File on each site. Then remove the test page.

  1. Add the new version beside the old one.
  2. Test one site with a site-level handler.
  3. Compare extensions and php.ini.
  4. Move sites one at a time.
  5. Keep the old version until rollback is no longer needed; then remove its FastCGI app and directory.

PHP 8.4.27 NTS + IIS FastCGI was verified on VM 361. The 8.3 side-by-side setup is E1; use the same procedure on Server 2025 and record both phpinfo pages before calling it E2.

Sources