search
HomeBackend DevelopmentPHP ProblemWhat to do if a 500 error occurs on the php server

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

2. Restart the apache service

service httpd restart

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

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

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Clair Obscur: Expedition 33 - How To Get Perfect Chroma Catalysts
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft