Recent Changes - Search:

add Cookbook page

hide Cookbook

Cookbook


hide Topics

Topics

show Changed

Changed

Visitor's book Site map pmwiki-2.7.6 5630

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.6; 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
  • Administrator access
  • PHP Non-Thread-Safe (NTS) x64 ZIP package from php.net

Installation Notes

  • no Web Platform Installer (WebPI): Microsoft officially retired WebPI in December 2022.
  • sse 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

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

  • Download the latest Non-Thread-Safe (NTS) x64 ZIP from: php.net
  • Extract it to a folder such as: C:\Program Files\PHP\v9.9.9

IIS requires NTS builds. PHP requires the Visual C++ Redistributable for Visual Studio 2015‑2022 x64 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

Configure IIS to process .php requests using FastCGI. Open IIS Manager:

  • select the computer name (the root node) in the left-hand Connections pane.
  • double-click Handler Mappings in the central panel.
  • edit the existing Module Mapping or in the right-hand Actions pane, click Add Module Mapping..
  • enter in the dialog box:
    Request path: *.php
    Module: Select FastCgiModule from the drop-down menu.
    Executable: C:\Program Files\PHP\v9.9.9\php-cgi.exe
    Name: PHP via FastCGI
  • click OK.
  • if 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 = 240  
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).

  • In IIS Manager, click your computer name in the left panel.
  • Double-click Default Document.
  • In the Actions pane on the right, click Add....
  • Type index.php and click OK.
  • Use the Move Up button in the actions pane to position index.php near the top of the list.
<?php 
if (chdir('pmwiki')) include_once('pmwiki.php');
?>

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 

IIS URL Rewrite

For Cookbook:CleanURLs.
web.config

URLRewriteInboundCleanURLs.png: 895x984, 221k (2026 Sept 17 07:32)
URLRewriteInboundEmptyRequest.png: 899x990, 212k (2026 Sept 17 07:32)

Temp directory permissions

For PHP and PmWiki to create and clean up temporary files on Windows these permissions are the minimum required for each site's application pool, e.g. with the identity for this site is: "IIS APPPOOL\MySite" grant the identity the permissions on the folder "C:\Windows\Temp" using Right‑click > Properties > Security

  • List folder contents
  • Read
  • Write

Change log

2024-05-05 Initial version

See also

tahi Page last modified on 2026 Sept 19 21:30

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