Install IIS (Internet Information Services) For PHP - fabulouscode

Sunday, August 24, 2025

Install IIS (Internet Information Services) For PHP


 Install IIS (Internet Information Services) For PHP



Download Link  IIS Manager


Step 1 — Install IIS (Internet Information Services)

First, we need to enable IIS on your machine.

For Windows 10/11 / Windows Server:

  1. Press Win + R, type:

    appwiz.cpl

    and press Enter.

  2. On the left side, click Turn Windows features on or off.

  3. In the list, find and check:

    • Internet Information Services

    • Expand IISWorld Wide Web ServicesApplication 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.

  4. Click OK.

  5. Wait until IIS installs.

Check IIS is installed:
Open a browser and go to:

http://localhost

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:

  1. Go to the official PHP website:
    https://windows.php.net/download/

  2. Choose the latest Thread Safe version of PHP (e.g., PHP 8.2 / 8.3).

  3. Download the .zip file (not the installer).

  4. Extract the ZIP file to a folder, e.g.:

    C:\PHP

Step 3 — Install PHP Manager for IIS (Optional but Recommended)

PHP Manager is a tool that makes managing PHP inside IIS much easier.

  1. Download PHP Manager for IIS:
    https://github.com/phpmanager/phpmanager/releases

  2. Run the installer.

  3. 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)

  1. Open IIS Manager.

  2. Click on your server name in the left panel.

  3. Double-click PHP Manager.

  4. Click Register new PHP version.

  5. Browse to:

    C:\PHP\php-cgi.exe
  6. Click OK.


Option 2: Manual Configuration

If you don't want to install PHP Manager, do it manually.

Steps:

  1. Open IIS Manager.

  2. Click on your server name → Double-click Handler Mappings.

  3. Click Add Module Mapping on the right.

  4. Fill in the details:

    • Request Path*.php

    • ModuleFastCgiModule

    • ExecutableC:\PHP\php-cgi.exe

    • NamePHP via FastCGI

  5. Click OK → When prompted, click Yes to create the FastCGI handler.


Step 5 — Configure php.ini

  1. Go to:

    C:\PHP
  2. Copy:

    php.ini-development

    Rename it to:

    php.ini
  3. Open php.ini in Notepad.

  4. Search for:

    ;extension_dir

    Update it:

    extension_dir = "C:\PHP\ext"
  5. Enable required extensions by removing the ; before them. For example:

    extension=mysqli extension=pdo_mysql extension=gd extension=curl
  6. Save the file.


Step 6 — Add PHP to System Environment Variables

  1. Right-click This PCProperties.

  2. Go to Advanced system settings.

  3. Click Environment Variables.

  4. Under System variables, find Path → Click Edit.

  5. Add:

    C:\PHP
  6. Click OK.


Step 7 — Configure IIS Default Document

  1. Open IIS Manager.

  2. Select your website → Double-click Default Document.

  3. Click Add.

  4. Enter:

    index.php
  5. Move index.php to the top of the list.


Step 8 — Test PHP Configuration

  1. Go to your IIS root folder:

    C:\inetpub\wwwroot
  2. Create a file named:

    info.php
  3. Paste the following code:

    <?php phpinfo(); ?>
  4. Open your browser and visit:

    http://localhost/info.php
  5. 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:

  1. Download the SQLSRV drivers from Microsoft:
    https://learn.microsoft.com/en-us/sql/connect/php/download-drivers-php-sql-server

  2. Extract and copy the php_sqlsrv.dll & php_pdo_sqlsrv.dll files into:

    C:\PHP\ext
  3. Open php.ini and enable:

    extension=php_sqlsrv.dll extension=php_pdo_sqlsrv.dll
  4. Restart IIS:

    iisreset

Step 10 — Restart IIS

No comments:

Post a Comment

I am Safiqul Islam Tuhin