Steps to Resolve 500 Internal Server Error for PHP in IIS on Windows 2016
In this blog, we will show you the steps to resolve 500 Internal Server Error for PHP in IIS on Windows 2016.
ACCESSING PHP INFO PAGE
- To troubleshoot this issue, place a phpinfo page under your website home folder.
<?php
phpinfo();
?>
- Open the web browser and access the URL http://localhost/phpinfo.php and if you see the 500 Internal Server Error. Follow the below steps.
VERIFY THE IIS HANDLER MAPPING
- Make sure that PHP was configured correctly in IIS.
- Open IIS snap-in and click on the server name.
- Double click on Handler Mappings icon.
- You can see the list of handlers configured in that server. Double click on the PHP handler.
- Make sure that php-cgi.exe was added as executable in IIS.
VERIFYING PHP MODULES
- Open the command prompt and go-to PHP binary folder. In this demo, it is C:\program files\php 7.1 folder.
- Type the below command to view the available modules in the PHP.
php –m
- If PHP dependencies are installed correctly it will show the list of available modules in PHP or it will show the error like below.
- It looks like Visual C++ is missing on the server. Google the VC++ and install it.
- Browse the below URL and download the Microsoft Visual C++ 2015 Redistributable Update 3 RC package.
https://www.microsoft.com/en-us/download/details.aspx?id=52685
- Click on Download and select vc_redist.x86.exe and click Next.
- Once the download is complete, double-click on the vc_redist.x86.exe file. Accept the License Agreement and click on Install button.
- Once the installation is successful click on close button.
- Verify the PHP modules from the command prompt again. Now you will able to see the list of modules available in PHP.
- Browse the info page again and you will able to see the PHP configuration information.
- So, PHP requires MSVC++ as a compiler to execute the coding.
VIDEO
Thanks for reading this blog. We hope it was useful for you to learn to resolve the PHP 500 internal server error in IIS
Loges