What to do if a 500 error occurs on the php server

王林
Release: 2023-03-07 07:56:01
Original
2076 people have browsed it

Solution to 500 error in php server: 1. Open the php.ini configuration file; 2. Modify the configuration [display_errors = On error_reporting = E_ALL | E_STRICT]; 3. Restart apache.

What to do if a 500 error occurs on the php server

After PHP novices set up the development environment in the early 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.

(Related video recommendations: java video tutorial)

The specific steps are as follows:

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

Configuration parameter value:

display_errors = On 
error_reporting = E_ALL | E_STRICT
Copy after login

2. Restart the apache service

service httpd restart
Copy after login

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

3. Continue to configure apache, open /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

4. Restart apache .

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

Call: Call the ini_set() function

ini_set('display_errors',1);
error_reporting(E_ALL);
Copy after login

This way you can dynamically output errors in the specified php file.

Related recommendations: php training

The above is the detailed content of What to do if a 500 error occurs on the php server. 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
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!