php开启与关闭错误提示适用于没有修改php.ini的权限_PHP

WBOY
Release: 2016-05-31 19:29:22
Original
939 people have browsed it

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/a(www.bitsCN.com)pache2 目录下。

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

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!