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:
- To discover our recommendations for the best shared web hosting, click here at this link.