Recent Changes - Search:

add Cookbook page

hide Cookbook

Cookbook


hide Topics

Topics

show Changed

Changed

Visitor's book Site map pmwiki-2.7.5 5601

Install PHP On IIS

To do
  • change skiwi
  • update prerequisites
  • remove this comment

Summary: A recipe to
Version: 2024-05-05
Prerequisites: PmWiki pmwiki-2.7.5; PHP 8.4+ (NTS x64); Windows 10; IIS with CGI/FastCGI enabled
Status: Alpha
Maintainer: skiwi
Licence: GPL3#
Categories: PHP, IIS
Users: (view / edit)

Questions answered by this recipe

How do I install PHP on IIS (Windows 10)

Overview

This guide covers manually installing PHP on Internet Information Services (IIS) on Windows 10.

Windows 10 can run PHP under IIS using FastCGI. Older IIS PHP methods such as ISAPI and PHP Manager are deprecated and should not be used.

Requirements

  • Windows 10
  • IIS installed
  • CGI / FastCGI enabled
  • Administrator access
  • PHP Non-Thread-Safe (NTS) x64 ZIP package from windows.php.net

Installation Notes

  • No Web Platform Installer (WebPI): Microsoft officially retired WebPI in December 2022. Do not attempt to use it.
  • Use FastCGI with NTS PHP: Always use the "Non-Thread Safe (NTS)" 64-bit build of PHP. The FastCGI module handles thread isolation, so NTS is required for performance and stability.
  • Do not use ISAPI or Thread Safe builds: The old ISAPI module is deprecated and no longer supported in modern PHP releases.

Installation

Step 1: Enable IIS and FastCGI

Enable IIS and CGI support from Control Panel → Programs and Features → Turn Windows features on or off Enable under Internet Information Services

  • Web Management Tools - IIS Management Console
  • World Wide Web Services - Application Development Features → CGI
  • World Wide Web Services - Common HTTP Features: Default Document; Directory Browsing; HTTP Errors; Static Content
  • World Wide Web Services - Health and Diagnostics: HTTP Logging; Logging Tools; Request Monitor
  • World Wide Web Services - Performance Features: Dynamic Content Compression; Static Content Compression
  • World Wide Web Services - Security: Request Filtering; URL Authorization; Windows Authentication

This installs FastCGI support.

Download PHP for Windows

IIS requires NTS builds. PHP requires the Visual C++ Redistributable for Visual Studio 2015‑2022 x64(approve sites) installed.

Configure php.ini

  • Navigate to C:\Program Files\PHP\v9.9.9.
  • Copy the file php.ini-production and rename the copy to php.ini.

Initial installation

  1. Open C:\Program Files\PHP\v9.9.9\php.ini in a text editor like Notepad++ (running as Administrator).
  2. Update or uncomment the following directives (remove the leading ";"):
; Set the extension directory path
extension_dir = "C:\Program Files\PHP\v9.9.9\ext"
; Required FastCGI settings for IIS
fastcgi.impersonate = 1
cgi.fix_pathinfo = 1
cgi.force_redirect = 0

; Core extensions needed for general PHP and PmWiki support
extension=curl
extension=fileinfo
extension=gd
extension=mbstring
extension=openssl
extension=session
  • Save and close the file.

Upgrade installation

Use WinMerge to compare and merge to old to new php.ini files

Configure IIS Handler Mapping

Now tell IIS to process .php requests using FastCGI.

  1. Press {Win + R}, type inetmgr, and press "Enter" to open IIS Manager.
  2. Select your computer name (the root node) in the left-hand Connections pane.
  3. Double-click Handler Mappings in the central panel.
  4. In the right-hand Actions pane, click Add Module Mapping....
  5. Fill out the dialog box with the following settings:
    • Request path: *.php
    • Module: Select FastCgiModule from the drop-down menu.
    • Executable (optional): C:\Program Files\PHP\v9.9.9\php-cgi.exe
    • Name: PHP via FastCGI
  6. Click OK.
  7. When prompted: "Do you want to create a FastCGI application for this executable?", click Yes.

Configure FastCGI Settings

In IIS Manager:

  • Select the server node
  • Open FastCGI Settings
  • Select the entry for php-cgi.exe

Edit the following values:

InstanceMaxRequests = 10000  
MaxInstances = 4  
ActivityTimeout = 30  
RequestTimeout = 90  

Set the PHP configuration directory:

Environment Variables → PHPRC = C:\Program Files\PHP\v9.9.9

Add index.php to Default Documents

Ensure IIS serves index.php automatically when opening a directory (important for PmWiki URL routing).

  1. In IIS Manager, click your computer name in the left panel.
  2. Double-click Default Document.
  3. In the Actions pane on the right, click Add....
  4. Type index.php and click OK.
  5. Use the Move Up button in the actions pane to position index.php near the top of the list.

Restart IIS

Restart IIS to apply changes:

iisreset

Or use the IIS Manager restart option.

Notes for PmWiki and KiwiWiki

PmWiki runs well under IIS + FastCGI. Recommended settings:

upload_max_filesize = 20M  
post_max_size = 20M  

Suggested opcache settings:

opcache.enable=1  
opcache.validate_timestamps=1  
opcache.revalidate_freq=2 

Change log

2024-05-05 Initial version

See also

tahi Page last modified on 2026 Sept 03 09:01

Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Install PHP On IIS"&Body=