• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

IIS Configuration: Configure IIS to work with PHP

December 18, 2023

IIS Configuration: Configure IIS to work with PHP

Introduction:
When it comes to hosting websites and web applications, IIS (Internet Information Services) is a popular choice among Windows users. It provides a robust and secure platform for hosting various types of websites. However, by default, IIS does not support PHP, a widely used scripting language for web development. In this article, we will explore how to configure IIS to work with PHP, allowing you to host PHP-based websites on your IIS server.

Step 1: Install PHP:
Before configuring IIS to work with PHP, you need to install PHP on your server. You can download the latest version of PHP from the official PHP website (https://www.php.net/downloads.php). Choose the Windows Installer version that matches your server’s architecture (x86 or x64). Run the installer and follow the on-screen instructions to complete the installation.

Step 2: Configure PHP:
Once PHP is installed, you need to configure it to work with IIS. Locate the php.ini file in your PHP installation directory (usually C:php). Open the file in a text editor and make the following changes:

1. Uncomment the line that starts with “extension_dir” by removing the semicolon (;) at the beginning of the line. Set the value to the “ext” folder in your PHP installation directory. For example, “extension_dir = “C:phpext””.

2. Uncomment the line that starts with “cgi.force_redirect” and set it to 0. This disables CGI redirection, allowing PHP to work properly with IIS.

3. Uncomment the line that starts with “fastcgi.impersonate” and set it to 1. This enables FastCGI impersonation, which improves security by running PHP scripts under the identity of the website’s application pool.

Save the changes to the php.ini file and restart the IIS service for the changes to take effect.

Step 3: Configure IIS:
Now that PHP is configured, you need to configure IIS to recognize and process PHP files. Follow these steps:

1. Open the IIS Manager by searching for “Internet Information Services (IIS) Manager” in the Start menu.

2. In the IIS Manager, navigate to the server node and double-click on “Handler Mappings”.

3. In the Actions pane on the right, click on “Add Module Mapping”.

4. In the “Add Module Mapping” dialog, enter the following details:
– Request path: *.php
– Module: FastCgiModule
– Executable: C:phpphp-cgi.exe (replace with the path to your PHP installation directory)
– Name: PHP_via_FastCGI

Click “OK” to save the module mapping.

Step 4: Test PHP:
To verify that PHP is working correctly with IIS, create a simple PHP file and place it in your website’s root directory. For example, create a file named “test.php” with the following content:

“`php

“`

Save the file and access it through a web browser by navigating to “http://localhost/test.php” (replace “localhost” with your server’s hostname or IP address). If PHP is configured correctly, you should see a page displaying detailed information about your PHP installation.

Summary:
Configuring IIS to work with PHP allows you to host PHP-based websites on your Windows server. By following the steps outlined in this article, you can install PHP, configure it to work with IIS, and test its functionality. For reliable and secure Hong Kong VPS hosting services, consider Server.HK. Our VPS solutions are top-notch and cater to a wide range of hosting needs. Visit us at https://server.hk for more information.

Recent Posts

  • How to Run Ollama and Local LLMs on a Hong Kong VPS: AI Inference for Asia-Pacific (2026)
  • Hong Kong VPS vs Vultr: Which Is Better for Asia-Pacific Deployments in 2026?
  • How to Set Up a Reverse Proxy on Hong Kong VPS: Nginx, Multiple Apps, and SSL Management (2026)
  • IPv6 on Hong Kong VPS: Setup, Benefits, and Why It Matters for Asia-Pacific in 2026
  • Hong Kong VPS PostgreSQL Setup: High-Performance Database Configuration for Asia-Pacific (2026)

Recent Comments

  1. Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026) - Server.HK on How to Monitor Your Hong Kong VPS: Uptime, Performance, and Alert Setup Guide (2026)
  2. Best Hong Kong VPS Providers in 2026: Compared by Speed, Routing, and Value - Server.HK on How to Migrate Your Website to a Hong Kong VPS: Zero-Downtime Transfer Guide (2026)
  3. vibramycin injection on How to Choose the Right Hong Kong VPS Plan: A Buyer’s Guide for 2026
  4. allopurinol for gout on CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  5. antibiotics online purchase on How to Set Up a WordPress Site on a Hong Kong VPS with aaPanel (Step-by-Step 2026)

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot