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
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
- Open
C:\Program Files\PHP\v9.9.9\php.ini in a text editor like Notepad++ (running as Administrator).
- 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
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:
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
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