Install IIS (Internet Information Services) For PHP
Step 1 — Install IIS (Internet Information Services)
First, we need to enable IIS on your machine.
For Windows 10/11 / Windows Server:
-
Press Win + R, type:
and press Enter.
-
On the left side, click Turn Windows features on or off.
-
In the list, find and check:
-
Internet Information Services
-
Expand IIS → World Wide Web Services → Application Development Features
Enable:-
ASP.NET (Both 3.5 & 4.8 if available)
-
ISAPI Extensions
-
ISAPI Filters
-
CGI
-
-
Under Web Management Tools, enable IIS Management Console.
-
-
Click OK.
-
Wait until IIS installs.
✅ Check IIS is installed:
Open a browser and go to:
If you see the IIS Welcome Page, IIS is installed successfully.
Step 2 — Download and Install PHP
We'll use the PHP for Windows (Thread Safe) version for IIS.
Steps:
-
Go to the official PHP website:
https://windows.php.net/download/ -
Choose the latest Thread Safe version of PHP (e.g., PHP 8.2 / 8.3).
-
Download the .zip file (not the installer).
-
Extract the ZIP file to a folder, e.g.:
Step 3 — Install PHP Manager for IIS (Optional but Recommended)
PHP Manager is a tool that makes managing PHP inside IIS much easier.
-
Download PHP Manager for IIS:
https://github.com/phpmanager/phpmanager/releases -
Run the installer.
-
After installation, open IIS Manager → You'll see PHP Manager under the IIS section.
Step 4 — Configure PHP in IIS
Option 1: Using PHP Manager (Recommended)
-
Open IIS Manager.
-
Click on your server name in the left panel.
-
Double-click PHP Manager.
-
Click Register new PHP version.
-
Browse to:
-
Click OK.
Option 2: Manual Configuration
If you don't want to install PHP Manager, do it manually.
Steps:
-
Open IIS Manager.
-
Click on your server name → Double-click Handler Mappings.
-
Click Add Module Mapping on the right.
-
Fill in the details:
-
Request Path →
*.php
-
Module →
FastCgiModule
-
Executable →
C:\PHP\php-cgi.exe
-
Name →
PHP via FastCGI
-
-
Click OK → When prompted, click Yes to create the FastCGI handler.
Step 5 — Configure php.ini
-
Go to:
-
Copy:
Rename it to:
-
Open
php.ini
in Notepad. -
Search for:
Update it:
-
Enable required extensions by removing the
;
before them. For example: -
Save the file.
Step 6 — Add PHP to System Environment Variables
-
Right-click This PC → Properties.
-
Go to Advanced system settings.
-
Click Environment Variables.
-
Under System variables, find Path → Click Edit.
-
Add:
-
Click OK.
Step 7 — Configure IIS Default Document
-
Open IIS Manager.
-
Select your website → Double-click Default Document.
-
Click Add.
-
Enter:
-
Move
index.php
to the top of the list.
Step 8 — Test PHP Configuration
-
Go to your IIS root folder:
-
Create a file named:
-
Paste the following code:
-
Open your browser and visit:
-
If you see the PHP Information Page, PHP is successfully configured.
Step 9 — Configure PHP with SQL Server (Optional)
If you want to connect PHP with SQL Server:
-
Download the SQLSRV drivers from Microsoft:
https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server -
Extract and copy the
php_sqlsrv.dll
&php_pdo_sqlsrv.dll
files into: -
Open
php.ini
and enable: -
Restart IIS:
No comments:
Post a Comment
I am Safiqul Islam Tuhin