How to install PHP on IIS 10 in Windows Server
If you open a .php file on an IIS website and PHP is not properly installed or mapped to FastCGI, IIS returns an HTTP 500 Internal Server Error in your browser.

Note: Always install the latest PHP 8.x (PHP 8.4 or newer, Non-Thread Safe x64) build directly via FastCGI on IIS 10 (Microsoft Web Platform Installer is retired).
Step 1: Enable IIS and the CGI Feature
- Open Server Manager on Windows Server 2025 / 2022 and choose Add roles and features.
- Select Web Server (IIS).
- Expand Web Server > Application Development and check CGI (this enables FastCGI support in IIS).
- Complete the installation wizard.
Step 2: Install Visual C++ Redistributable
Modern Windows PHP 8.x builds require the Microsoft Visual C++ Redistributable (x64, Visual Studio 2015–2022 / latest supported release):
- Download and install the x64
vc_redist.x64.exepackage from Microsoft Learn.
Step 3: Download and Extract PHP 8.4 / Latest PHP 8.x (NTS)
- Go to windows.php.net/download.
- Download the VS17 x64 Non Thread Safe (NTS)
.zippackage for PHP 8.4 (or the latest PHP 8.x release — IIS FastCGI requires the NTS build). - Extract the archive to
C:\PHP. - Copy
C:\PHP\php.ini-productiontoC:\PHP\php.iniand adjust these essential IIS settings insidephp.ini:
cgi.fix_pathinfo=0
fastcgi.impersonate=1
extension_dir = "ext"
date.timezone = "Europe/Amsterdam"
(Uncomment the extensions you need, such as extension=curl, extension=mbstring, extension=mysqli, extension=openssl, and extension=pdo_mysql.)
Step 4: Configure IIS FastCGI Handler Mapping
- Open IIS Manager (
inetmgr). - Select your server node (or specific website) and double-click Handler Mappings.
- Click Add Module Mapping... in the Actions pane and enter:
- Request path:
*.php - Module:
FastCgiModule - Executable:
C:\PHP\php-cgi.exe - Name:
PHP_FastCGI
- Request path:
- Click OK and confirm Yes when asked to create a FastCGI application entry.
- (Optional) Double-click Default Document in IIS Manager and add
index.phpif not present.
Step 5: Test PHP with info.php
Create C:\inetpub\wwwroot\info.php with the following contents:
<?php
phpinfo();
Open http://localhost/info.php in your browser to verify PHP 8.x loads cleanly under IIS 10.
Security Warning: Immediately delete
info.phponce you have verified your installation (Remove-Item C:\inetpub\wwwroot\info.php). Leavingphpinfo()accessible leaks server paths, PHP versions, and environment variables.