php close error

王林
王林Original
2019-10-10 17:51:254250browse

php close error

1. Add the following code directly to the php code:

error_reporting(E_ALL^E_NOTICE^E_WARNING);

This will close all notices and warning level errors. Put this statement in the function include file of your script, usually config.php or conn.php to control the output.

2. Close the error prompt by configuring the php.ini file

The method is as follows:

1. Open the php.ini file in the PHP installation directory

2. Find display_errors = On Change to display_errors = off

Note:

If You have copied the PHP.ini file to the windows directory, then you must also change display_errors = On in c:windows/php.ini to display_errors = off.

Problem:

The PHP setting file php.ini has clearly set display_errors = Off, but during the running process, error messages still appear on the web page.

Solution:

1. Open the php.ini file in the PHP installation directory

2. Find log_errors = off Modify it to log_errors = on

3, find error_log = filename and modify it to error_log="D:PHPerrlogphp_error.log" (the directory here And the file name D: PHPerrlogphp_error.log whatever you choose)

Note:

If you have copied the PHP.ini file to the windows directory, you must also Put the c:windows/php.ini file. In addition, php_error.log must have at least USER's modification and write permissions, otherwise the error log cannot be output.

Recommended tutorial: PHP video tutorial

The above is the detailed content of php close error. 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