Adding new programming language functionality to IIS is pretty streamlined these days via the use of Microsoft's Web Platform Installer which bundles together installers and modules for various languages and handles all the setup for you with a couple of clicks.
However, there is a slight stumbling block when trying to add PHP support to IIS in Windows Server 2016. Specifically, when you go to use Web Platform Installer to install a PHP version, the PHP binaries and modules will install fine, but you'll encounter the following fatal error when the automatically included PHP Manager for IIS tries to install:
Now, strictly speaking you don't need this, it just provides a UI for managing loaded extensions in the php.ini, etc., but it's definitely a nicety to have for managing the config directly within the IIS. Fortunately the fix is easy, albeit involving a bit of registry hacking (Or as my coworker would prefer to call it 'Configuration Changing').
First things first, hit start and in the start menu, type in regedit and open it. In here, via the left, browse through the folder structures to the following location:
Your regedit window should look as follows:
Double click on the MajorVersion value, and in the window that pops up, set the Base to Decimal and the Value Data to 8, so the resulting window should look like:
Save, and then without closing regedit, go to Web Platform Installer and you should be able to install PHP Manager without any issues. Once installed, go back to the regedit window and edit the same MajorVersion Value in the same way, but set the Value back to 10.
Essentially we're spoofing our windows version to the installer as the error occurs due to it checking which windows you're running and failing due to it not matching what it thinks it can support. This is exactly why I'd consider it Registry Hacking rather than simple configuration changes, and also why you should put the value back as there's probably a number of fun ways having software thinking you're running a different version of windows than you are can cause you issues.