0

I have a folder running a PHP application configured in IIS. Here's the current setup:

  • Site Name: Original Website
  • PHP Manager > PHP Version: 7.0
  • Bindings: * on ports 80 and 443
  • Handler Mappings: First handler is PHPv7.0 using FastCGI

Now, I want to run the same application folder using PHP 8, accessible via a different domain (e.g., php8.example.com.local). The goal is to test the app on PHP 8 while keeping the original running on PHP 7.0.

Here’s what I tried:

Created a new IIS website (PHP 8 Website) pointing to the same folder.

Set bindings to only php8.example.com.local.

Changed the PHP version to 8 in PHP Manager for the new site.

When I change the PHP version in the new site, the original site also switches to PHP 8 (and vice versa). It seems the PHP version setting is global, even though they are separate sites.

I also tried modifying Handler Mappings at the site level to switch only the PHP 8 Website to use PHPv8.0, but that also affects the original site.

How can I configure IIS to serve the same application folder using two different PHP versions, based on the domain name?

2
  • Do not change the Handler Mapping, but create a new Handler Mapping. Commented Jul 22 at 6:25
  • @Luuk, I tried exactly that. However, it still seems to use a "shared" config. So, once I create a new handler mapping & order it to top, the other site is impacted automatically Commented Jul 23 at 4:53

1 Answer 1

0

"How to host the same folder in IIS using two different PHP versions?"

IIS shows "Virtual folders" or "Applications". when you say "Same folder" I think you do mean same folder in Windows, but different Application under IIS.

I created a second handler that looks like this under "Handler Mappings", just for the second application:

enter image description here

Do note that from the webroot, and below the php81 is available, and the `PHP8.4``, which has an "Entry type" of "Local", is only available in the application where it is defined (which is not the "Default website"

The Module Mapping of PHP8.4 look like this: enter image description here

P.S. "PHP8.4" and "php81" are just local names which do not (necessarily) refer to any specific PHP version.

1
  • Let me try that out & tell you Commented Jul 23 at 13:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.