How To Set Up IIS To Manage PHP Requests Through IIS Manager And Command Line

How To Set Up IIS To Manage PHP Requests Through IIS Manager And Command Line

If you are reading this article it presupposes that you know what Internet Information Service (IIS) is all about. So now I’m going to teach and show you how to set up IIS to Manage PHP queries.

In order for PHP applications to be hosted with IIS, it is an absolute necessity that you include a handler mapping so as to notify Internet Information Service to pass each and every PHP-detailed queries to PHP app framework by utilizing the FastCGI set of rules.

A: How To Configure Internet Information Service to Operate PHP Queries By Making use Of IIS Manager.

Step 1: Open The Internet Information Service Manager And Double Click On The Handler Mappings

First, you need to open the Internet Information Service Manager. Now go ahead and double-click on the Handler Mappings at the server level.

Step 2: Integrate Module Mapping

Next, tap on “Add Module Mapping” located in the Actions pane. Then, in the Module Mapping window, list the setting of the configuration as you see it below:

  • Request path – *.php
  • Module – FastCgiModule
  • Executable -“C:[Path to your PHP installation]php-cgi.exe”
  • Name – PHP via FastCGI

Step 3: Okay The Request

After doing all that, click on Ok.

Step 4: Confirm the FastCGI App Set Up

Where you are asked in the “Add Module Mapping” verification window “Do you want to make a FastCGI app for this executable”, tap on the Yes button.

Step 5: Test Test That The Handler Mapping Works

Check if the handler mapping is working properly by setting up a phpinfo.php file in the C:inetpubwwwroot folder which has the code below:

XMLCopy

<?php phpinfo(); ?>

STEP 6: Launch Browser

All you need to do now is to launch a browser then go to http://localhost/phpinfo.php. As long as you did set up everything correctly, the customary PHP page will definitely appear with information.

Take Note Of The Following:

Step 7: See If FastCGI Module Is Registered

The moment you are unable to see FastCgiModule appear in the Modules’ list, it then simply means that you may not have registered the module or you are yet to enable the module. For you to verify whether the FastCGI module has been registered, you need to open the Internet Information Service configuration file which you will find at %windir%windowssystem32configapplicationHost.config also make sure that the subsequent line is there in the <globalModules>section:

XMLCopy

<add name="FastCgiModule" image="%windir%System32inetsrviisfcgi.dll" />
In that same file, ensure also that you included the FastCGI module to the <modules> section:
XMLCopy
<add name="FastCgiModule" />

B: Configuring IIS To Operate PHP Requests With The Use Of The Command Line

On the other hand, you can finish the above steps by applying the command line device known as A ppCmd.

Step 1: Generate FastCGI App Process Group

Set up the FastCGI app process group by entering the command shown below:

consoleCopy

C:>%windir%system32inetsrvappcmd set config /section:system.webServer/fastCGI /+[fullPath='c:{php_folder}php-cgi.exe']

Step 2: Set Up Handler Mapping

Enter the below command to set up the handler mapping:

consoleCopy

C:>%windir%system32inetsrvappcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:{php_folder}php-cgi.exe',resourceType='Unspecified']

Take Note Of The Following:

If, perchance you are making use of PHP version 4.X, you may as an alternative make use of php.exe rather than the php-cgi.exe.

PHP Web Sites’ Security Isolation

The recommendation in a shared web hosting situation to isolate PHP Web sites is in line with every single common safety isolation recommendations meant for IIS. Above all, it is advised:

  • To utilize one application group for each Web site
  • To employ a user account to serve as identification for the app group – but the user account must be a dedicated one
  • To configure an identity that is anonymous to make use of the app group identity
  • To make sure that you enable the fastcgi impersonation in the php.ini file (fastcgi.impersonate=1)

Conclusion

As you can see, the setting up of IIS to Manage PHP Requests is not a very difficult task as long as you follow the laid down step by step procedures in this article. If you have any need for further details and clarifications as regards shared hosting environment security isolation, you can either check the related article on this site or give us a shout.

Check out these top 3 Windows hosting services:

Ultahost
$2.90 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
    4.3
  • Support
    4.8
  • Features
    4.5
  • Reliability
    4.0
  • Pricing
    4.8
Kamatera
$4.00 /mo
Starting price
Visit Kamatera
Rating based on expert review
  • User Friendly
    3.5
  • Support
    3.0
  • Features
    3.9
  • Reliability
    4.0
  • Pricing
    4.3
IONOS
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3

How To Harden a Windows IIS Web Server

The article covers how to improve security in Windows Internet Information servi
3 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to Install the WISA (Windows, IIS, SQL, ASP.NET) Stack

WISA is an acronym which stands for (Windows, IIS, SQL, and ASP.net).WISA uses W
3 min read
Vladimir Rakov
Vladimir Rakov
Hosting Expert

How To Disable The Vulnerability of Options Method in IIS and Apache

OPTIONS offer a potential attacker a loophole that serves as a shortcut to anot
3 min read
Craig Timmins
Hosting Expert

How to Set Up IIS Application Pool (Windows) in Plesk

IIS Application Pool contains all web applications installed on your sites. You
2 min read
Elizabeth Njoroge
Elizabeth Njoroge
Author
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top