How to solve php 5.6 iis error 500

PHPz
Release: 2023-04-21 10:32:38
Original
1036 people have browsed it

Recently, when I deployed a website based on PHP 5.6 and IIS, I encountered a very troubling problem, namely error 500. After constant debugging and trying, I finally found a solution to the problem, and here are the detailed steps of the whole process.

1. Check the php.ini configuration file

First, I checked the php.ini configuration file and found that for this website, there are two different configuration files, one is located in the php installation directory , one is in the root directory of the website. In both files, I found a setting called error_reporting, which is one of the causes of error 500.

error_reporting specifies the error level to be reported by php. If it is set to E_ALL, all errors will be displayed, including warning and prompt level errors, and this may cause iis to return a 500 error. Therefore, I changed this setting to E_ERROR so that php will only report errors that cause the script to terminate, avoiding the error 500 situation.

2. Check iis FastCGI settings

However, despite changing the php.ini configuration file, the website still received error 500. At this time, I began to suspect that FastCGI was related to iis.

In order to determine the problem to the greatest extent, I modified each website and the default website. Regarding error 500, you also need to check the following items:

a. The CGI paths of php.exe, php-cgi.exe and php.ini must be added to the "Environment Variables" section in the FastCGI settings.

b. In "Handler Mapping", change the code of FastCGIModule to FastCGI.

c. For each website or default website, please ensure that the configuration folder path set by FastCGI is correct. A common method is to set the configuration folder path to C:\PHP, and this path It is also the default installation path of php.

3. Check the iis log

At the same time, I also checked the error details in the iis log. Under the "Website" section of the IIS Manager, right-click the website and select "Manage Website" - "Bank Log" - "Certificate" to find the path to the IIS log. In this log file, I found an important error message: "The process cannot be started because the library file cannot be found".

This error usually means that iis started the wrong php or FastCGI process, or did not have the correct permissions during runtime or the permissions have been modified. To fix this, I reinstalled PHP, made sure IIS started the correct PHP process, and confirmed the permissions were set correctly.

Summary

After troubleshooting all possible problems, my php 5.6 iis website is finally running normally. This problem-solving process was very long, but it was still a learning and growing experience.

The solution may vary depending on the environment and settings, but checking the php.ini configuration file and the FastCGI settings of iis is always the first priority. In this process, it is very beneficial for us to develop and maintain websites based on PHP and IIS by deeply understanding how PHP and IIS work, constantly debugging and digging out the root causes of the problem, and not just looking at the problem on the surface.

The above is the detailed content of How to solve php 5.6 iis error 500. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!