Skip to content

How to fix 500 Internal Server Error for PHP in IIS on Windows 2016

Updated 2 min read

Updated: 28 September 2026 · Applies to: Windows Server 2016 to 2025 with IIS 10 and PHP 8.x

Windows Server 2016 is out of mainstream support; these steps also apply to Windows Server 2019, 2022 and 2025 with IIS 10. A 500 Internal Server Error for PHP pages means PHP failed to run or IIS is not set up to run it.

1. See the real error

IIS hides error details from remote visitors. Open the page on the server itself (http://localhost/info.php with <?php phpinfo();), or show detailed errors temporarily in the site's web.config:

<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>

2. Check the usual causes

  • Missing Visual C++ runtime: current PHP builds need the Microsoft Visual C++ 2015 to 2022 Redistributable (x64). Install it and restart IIS.
  • Wrong PHP build: IIS with FastCGI needs the Non Thread Safe (NTS) x64 build of PHP.
  • Handler mapping: in IIS Manager › Handler Mappings, *.php must use FastCgiModule with the full path to php-cgi.exe. The CGI role service of IIS must be installed.
  • php.ini: copy php.ini-production to php.ini, set extension_dir = "ext", cgi.force_redirect = 0 and fastcgi.impersonate = 1, and enable only the extensions you need.
  • Permissions: the application pool identity (IIS AppPool\YourPool) needs read access to the site and the PHP folder, and write access to upload and session folders.

3. Read the logs

Set log_errors = On and error_log = C:\PHP\logs\php_errors.log in php.ini. IIS logs are in C:\inetpub\logs\LogFiles; the substatus code (for example 500.0) narrows the cause. Switch detailed errors off again when you are done.

Related services

Hire an expert

engineers per 15 minutes, per hour or per month, with no contract.

Server management

on-demand administration, hardening, migrations and monitoring.

Was this answer helpful?

Still stuck? Open a ticket