How to resolve php 500 - Internal Server Error

藏色散人
Release: 2023-03-07 06:20:01
Original
5014 people have browsed it

Solution to php 500 internal server error: first find the php configuration file and configure the parameter value to "display_errors = On"; then add "php_flag display_errors" to the apache configuration file; finally restart the apache service. Can.

How to resolve php 500 - Internal Server Error

Recommended: "PHP Video Tutorial"

php server 500 error solution

php newbie After setting up the development environment in the initial stage, when a syntax error occurs during development, the server returns 500 (server internal error) instead of returning an error message. At this time, you need to make some configurations in the development environment to help you quickly find the cause of the problem, locate the problem, and solve the problem.

Find the php configuration file /etc/php.ini

Configuration parameter value: display_errors = On

error_reporting = E_ALL | E_STRICT
Copy after login

Restart the apache service service httpd restart

This At this time, the browser can already output error messages.

You need to configure apache again /etc/httpd/conf/httpd.conf

Add two lines at the end of the apache configuration file:

php_flag display_errors on php_value error_reporting 2039
Copy after login

Restart apache.

The setting of parameters in php.ini can also be done in php code.

Call: Call the ini_set() function

//开启php.ini中的display_errors指令 ini_set('display_errors',1); //通过error_reporting()函数设置,输出所有级别的错误报告 error_reporting(E_ALL);
Copy after login

This can be used dynamically and output errors in the specified php file.

The above is the detailed content of How to resolve php 500 - Internal Server Error. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
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!