Once you have a working website - you may find a need to create a second website on the same computer. One such reason is that some programs or add ins do not work with PHP7.x (The latest version) but work perfectly with an earlier version such as PHP5.x.
I will assume you have PHP5.x installed.
First step is to install a copy of PHP7.x and for this you can simply use the Web Platform Installer from Microsoft.
once installed check that your website is now using PHP7.x
Having satisfied yourself that this is the case we can now proceed to create a second website - but the second website will be configured to use your other version of PHP5.x. We also need to make sure that MySQL / MySQLi works on the second website.
Edit the following file on your computer:
Code: Select all
C:\Windows\System32\Tasks\MySQL\Installer\ManifestUpdate
Find the line
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
and change it to
<MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
Next Step:
Open IIS Manager on your computer.
in the section IIS look for "Handler Mappings"
In the name column you will find an entry "PHP_via_FastCGI" and another one "PHP_via_FastCGI1" - if you have previously updated your version of PHP perhaps from PHP5.4 to PHP6.1 then you may find more similar entries such as "PHP_via_FastCG2" "PHP_via_FastCG3" and so on. Double click an entry and
look at the entry Executable (optional) - this will identify which version of PHP that entry refers to. Make a note of the name of the original PHP you were using before installing PHP7. Make another note of the name of the new PHP7 entry.
On the right hand column of the Handler Mappings screen you will see a line that reads "View ordered list..."
What you now do is click that line and now the list of handler mapping entries is no longer in alphabetical order but is in order of importance, The entry at the top of the list takes precedence of those below. You will also see in the Actions column options to move an entry up/down.
Using these options move the "PHP_via_FastCGI" entry relating to your original PHP5.x to the top of the list.
If you now check your website again you will find that it is again using PHP5.x
We will now create a second website.
in Windows Explorer go to the root of your website which is normally C:\inetpub\wwwroot
Now create a new folder C:\inetpub\www2
This is where your second website will reside. You may want to copy a few things over from your existing website such as
PHPinfo.php
the directory phpMyAdmin
iisstart.htm
While these files are not necessary you will find it useful to have something in the website if only to make sure it is working!
Next step is to go back into IIS Manager and in the left hand column click "Sites"
At this point there should only be the one site shown - your existing site.
On the right had side of IIS Manager under the "Actions" column you will see "Add Website"
Click this and a pop up appears for you to fill in.
Give the site a name such as web2.
Under content directory "Physical Path" navigate to your new web site C:\inetpub\www2
Under "Binding" alter the port number from 80 to 81, click the OK button and your site is now ready.
Goto your web browser and enter the address http://localhost:81/ - you should now see the welcome screen. (You can change localhost to whatever name you have called your computer). Now check that PHP is working on your new site
http://localhost:81/phpinfo.php
At this point both your original site
http://localhost/
and new site
http://localhost:81
Are using the same version of PHP 5.x
Once again go to IIS manager.
Select your original website and go to the Handler Mappings screen. Using the move options move the "PHP_via_FastCGI" entry relating to your new PHP7.x to the top of the list.
A pop up will appear which you have to confirm before you are able to move the entry.
You ONLY move this entry on the one website not both!
Now check that PHP7.x is working on your original site
http://localhost/phpinfo.php
and that PHP5.x is working on your new site
http://localhost:81/phpinfo.php
One last thing - if you are using your web server as a publicly viewable site then don't forget to allow an exception in Windows Firewall for Port 81 otherwise no one will be able to see it outside of your LAN.
Don't forget to add port forwarding in respect of port 81 in your network router.
That's it - you're all done!