Home  >  Article  >  Backend Development  >  php web page error code 500

php web page error code 500

王林
王林Original
2019-09-30 11:53:362890browse

php web page error code 500

After a novice has set 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.

1. Find the php configuration file /etc/php.ini

2. Configuration parameter value:

display_errors = On

##error_reporting = E_ALL | E_STRICT

3. Restart the apache service

service httpd restart

At this time the browser can already output error messages.

4. You need to configure the apache/etc/httpd/conf/httpd.conf file again

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

php_flag display_errors on

php_value error_reporting 2039

5. Restart apache

Setting 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);

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

Recommended tutorial:

PHP video tutorial

The above is the detailed content of php web page error code 500. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:php web page garbled codeNext article:php web page garbled code