Home Backend Development PHP Tutorial Turn on and off error prompts in php_PHP tutorial

Turn on and off error prompts in php_PHP tutorial

Jul 13, 2016 am 10:49 AM
php and closure several kinds Can exist turn on hint method have of mistake

There are several ways to turn on and off error prompts in php. One can directly use the relevant functions in the program to open an account. The other is that we can use the configuration parameters in php.ini to control it. The following editor will give you Let me introduce it to my classmates.

Windows system switch php error message

If you do not have the permission to modify php.ini, you can add the following code to the php file:

The code is as follows
 代码如下 复制代码

ini_set("display_errors", "On");

error_reporting(E_ALL | E_STRICT);

Copy code

 代码如下 复制代码

找到display_errors = On 修改为 display_errors = off

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

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

ini_set("display_errors", "On");


error_reporting(E_ALL | E_STRICT);

Of course, if you can modify php.ini, as follows:

Take my ubuntu as an example, this file is in the /etc/php5/apache2 directory.
The code is as follows Copy code

 代码如下 复制代码
display_errors = Off
Find display_errors = On and change it to display_errors = off

Note: If you have copied the PHP.ini file to the windows directory, you must also change display_errors = On in c:windows/php.ini to display_errors = off
 代码如下 复制代码
error_reporting = E_ALL & ~E_NOTICE
或者搜索:
error_reporting = E_ALL & ~E_DEPRECATED
修改为
error_reporting = E_ALL | E_STRICT

Solution to the failure of display_errors = Off in PHP .ini


 代码如下 复制代码

php_flag display_errors        on
php_value error_reporting       2039

The method of turning on and off error prompts in Linux system is similar, but I will introduce it to you in detail

Linux system

 代码如下 复制代码
sudo /etc/init.d/apache2 restart
1. Open the php.ini file.
2. Search and modify the following line, change the Off value to On 3. Search down
The code is as follows Copy code
error_reporting = E_ALL & ~E_NOTICE Or search: error_reporting = E_ALL & ~E_DEPRECATED Modify to error_reporting = E_ALL | E_STRICT 4. Modify Apache’s httpd.conf, Take my Ubuntu as an example. This file is in the /etc/apache2/ directory. This is a blank file. Add the following two lines:
The code is as follows Copy code
php_flag display_errors on php_value error_reporting 2039 5. Restart Apache and it will be OK. Restart command: :
The code is as follows Copy code
sudo /etc/init.d/apache2 restart

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632675.htmlTechArticleThere are several ways to turn on and off error prompts in php. One can use the relevant functions directly in the program. Open an account, another way we can use the configuration parameters in php.ini to control, the following small...
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles