Introduction
This guide explains how to install PHP on Windows Server 2012, running under IIS (Internet Information Services), so you can host PHP-based applications like WordPress, phpMyAdmin, or custom PHP sites.
If you’ve seen older tutorials recommending the Microsoft Web Platform Installer (WebPI) for this: WebPI was officially retired by Microsoft, with its package feed shut down completely on December 31, 2022. It can no longer be used. This guide covers the current, correct method — installing PHP manually and registering it with IIS via FastCGI.
It’s also worth noting that Windows Server 2012 itself reached end of Extended Support in October 2023, meaning it no longer receives security updates. If you’re setting up a new server today, strongly consider a currently supported Windows Server version instead — Section II covers this in more detail.
Implementation
I. Prerequisites
Before you install PHP on Windows Server 2012, make sure you have:
- Administrative access to the server
- IIS installed, or willingness to install it as part of this guide
- Basic familiarity with Server Manager and IIS Manager
II. Important: Windows Server 2012 End of Support
Windows Server 2012 and 2012 R2 reached end of Extended Support on October 10, 2023 — Microsoft no longer releases security patches for the OS itself. If this is a new deployment, migrate to a currently supported Windows Server version (2019, 2022, or newer) before going further. If you’re maintaining an existing legacy system, the steps below remain accurate — just know the underlying OS carries elevated risk regardless of how well PHP is configured on top of it.
III. How PHP Runs Under IIS
Unlike Apache, IIS doesn’t run PHP as a built-in module — it uses FastCGI to hand off requests to a separate PHP process:
- A browser requests a
.phpfile from IIS - IIS’s FastCGI handler forwards the request to
php-cgi.exe php-cgi.exeexecutes the script and returns rendered HTML- IIS sends that output back to the browser

This is why the steps below both install IIS’s CGI feature and explicitly register php-cgi.exe as a handler.
IV. Enable IIS and the CGI Feature
- Open Server Manager → Add roles and features
- Select Web Server (IIS) under server roles
- Under Application Development, check CGI
- Complete the wizard
If IIS is already installed, add just the CGI feature the same way.
V. Download and Extract PHP
Since WebPI is no longer available, download PHP directly:
- Go to the official PHP for Windows downloads page
- Choose the version your application requires (many current apps need PHP 8.x)
- Download the Non-Thread-Safe (NTS) build, x64
Why NTS? Each FastCGI request runs as an independent PHP process rather than a shared thread, so Non-Thread-Safe is correct here. Thread-Safe builds are for different setups, like running PHP as an Apache module.
Extract the Zip package to a clean, space-free path:
C:\PHP
Avoid Program Files — spaces in the path can cause PHP/IIS configuration issues.
VI. Configure php.ini
Copy the production template:
copy C:\PHP\php.ini-production C:\PHP\php.ini
Edit php.ini and set at minimum:
extension_dir = "C:\PHP\ext"- Uncomment any extensions your app needs (
extension=mysqli,extension=curl,extension=gd, etc.) cgi.fix_pathinfo=0— more secure for IIS/FastCGI
VII. Register PHP with IIS via FastCGI
- Open IIS Manager, select your server name (not a specific site)
- Double-click Handler Mappings → Add Module Mapping
- Set:
- Request path:
*.php - Module:
FastCgiModule - Executable:
C:\PHP\php-cgi.exe - Name:
PHP via FastCGI
- Request path:
- Click OK, then Yes when prompted to create a FastCGI application
VIII. Set the Default Document (Optional)
In IIS Manager, select your site → Default Document → Add → enter index.php. Move it above index.html if you want it prioritized.
IX. Test and Verify
Place a test file at:
C:\inetpub\wwwroot\info.php
<?php phpinfo(); ?>
Visit http://localhost/info.php — you should see PHP’s configuration page.
Security note: Delete or restrict access to
info.phponce confirmed working — it exposes detailed server info useful to an attacker if left public.
X. Troubleshooting Common Issues
“Not Found” or a download prompt instead of the page rendering: Handler Mapping wasn’t saved correctly, or the FastCGI application wasn’t created — revisit Step VII.
500 Internal Server Error: Check the php-cgi.exe path for typos, and confirm php.ini sits in the same folder as php-cgi.exe.
A PHP function or extension seems missing: Revisit Step VI — confirm the extension is uncommented and extension_dir is correct.
Changes to php.ini don’t take effect: Run iisreset from an elevated command prompt to force FastCGI to pick up the change.
XI. Application Pool Permissions
If your app needs to write files (uploads, cache), grant its Application Pool identity access to just those specific folders:
- Right-click the folder → Properties → Security → Edit → Add
- Add
IIS AppPool\YourAppPoolName - Grant Modify only where write access is genuinely needed
Avoid granting broad permissions across your entire web root — scope access to just what’s needed.
XII. Conclusion
Installing PHP on Windows Server 2012 today means skipping WebPI (retired) and instead enabling IIS’s CGI feature, downloading PHP directly, and registering it via FastCGI Handler Mappings. This gives full visibility over your PHP version and configuration — but with Windows Server 2012 past end-of-support, treat this as maintenance for an existing system rather than a foundation for something new.
For the latest PHP releases, see the official PHP for Windows site.
Frequently Asked Questions
Can I still find and use the old Web Platform Installer somewhere? No — its package feed was shut down permanently on December 31, 2022, so even an old installer file wouldn’t be able to actually fetch or install anything.
Do I need Thread-Safe or Non-Thread-Safe PHP for IIS? Non-Thread-Safe (NTS) — the standard choice when running PHP under IIS via FastCGI.
Why use FastCGI instead of the old ISAPI module? ISAPI-based PHP was deprecated years ago and is no longer maintained. FastCGI is the current, supported method with better process isolation.
Talk to Our Technology Experts
Managing a Windows Server environment or need help with web server configuration? Our team can help with server setup, security hardening, and ongoing support.
Connect with our technology experts.