search
Homephp教程php手册php开启与关闭错误提示

php开启与关闭错误提示

Jun 13, 2016 am 09:51 AM
phpandclosureseveral kindsCanexistturn onhintmethodhaveofmistake

在php中开启与关闭错误提示的方法有几种一种可以直接在程序中使用相关函数来开户,另一种我们可以使用php.ini中配置参数来控制,下面小编来给各位同学介绍一下。

windows系统开关php错误提示

如果不具备修改php.ini的权限,可以将如下代码加入php文件中:

 代码如下 复制代码

ini_set("display_errors", "On");

error_reporting(E_ALL | E_STRICT);

当然,如果能够修改php.ini的话,如下即可:

 代码如下 复制代码

找到display_errors = On 修改为 display_errors = off

注意:如果你已经把PHP.ini文件复制到windows目录下,那么必须同时把c:windows/php.ini里的display_errors = On 修改为display_errors = off

PHP .ini中display_errors = Off失效的解决


在linux系统中开启与关闭错误提示方法差不多,不过我还是具体给大家介绍一下

linux系统下

1. 打开php.ini文件。

以我的ubuntu为例,这个文件在: /etc/php5/apache2 目录下。

2. 搜索并修改下行,把Off值改成On

 代码如下 复制代码
display_errors = Off

3. 搜索下行

 代码如下 复制代码
error_reporting = E_ALL & ~E_NOTICE
或者搜索:
error_reporting = E_ALL & ~E_DEPRECATED
修改为
error_reporting = E_ALL | E_STRICT

4. 修改Apache的 httpd.conf,

以我的 Ubuntu 为例, 这个文件在:/etc/apache2/  目录下,这是一个空白文件。
添加以下两行:

 代码如下 复制代码

php_flag display_errors        on
php_value error_reporting       2039

5. 重启Apache,就OK了。

重启命令: :

 代码如下 复制代码
sudo /etc/init.d/apache2 restart
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 Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools