Home > Backend Development > PHP Tutorial > PHP报错配置

PHP报错配置

WBOY
Release: 2016-06-20 12:46:17
Original
996 people have browsed it

一切的起点,首先要打开PHP报错

## vim php.inilog_errors = On  # 默认已开启error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT  # 默认已开启## 你也可以在php代码中 临时切换 当前处理的 PHP报错等级error_reporting ( E_ERROR  |  E_WARNING  |  E_PARSE );  # 函数返回先前的报错等级
Copy after login



其次,配置错误日志路径

## 我们指定php报错日志路径## vim php.inierror_log = /var/log/php_errors.log  # 需手动打开
Copy after login

如果没有指定php报错日志路径 , 则php的报错日志将写入 apache主机的错误日志路径中



已打开PHP报错后, 除了将报错写入日志中, 我们还能让错误信息 直接回显给浏览器输出

!! 线上部署环境下,务必关闭错误回显 !!

## vim php.inidisplay_errors = On  # 需手动打开## 你也可以在php代码中 临时切换 当前处理的 错误回显设置ini_set ( 'display_errors' ,  '1' );
Copy after login


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