PHP Error Hint Solution ____php

Source: Internet
Author: User
PHP in the installation, will be in the php.ini file to set up errors, reminders, warnings and other ways to appear, such a way that we can debug the PHP program in time to understand the problems of the program. Then, sometimes we do not need reminders, warnings, etc., such as when we use PHP5.5 (or higher), with the MySQL development environment, using the older MySQL connection, at this time PHP will be prompted: Please use the latest MySQL connection method, When you return to the foreground using the content of the database as a JSON format (or other), the content is often wrong

How to block this error, the method has the following:

1, to add a masking error reminder to a page that may (or has) occurred a reminder, or error, or warning:

Error_reporting (e_all ^ e_deprecated);

In this version php5.5, the old MySQL connection method is not recommended

But speedphp still follow the old connection method, when PHP will report e_deprecated hint, at this time turn off the hint OK, also can

PHP is placed in deployment mode (non-development mode), but the best solution is to use the latest speedphp

generally can also use the following content to solve some notice waring and so on

Ini_set ("Display_errors", 0);

Error_reporting (e_all ^ e_notice);

Error_reporting (e_all ^ e_warning);

2, open the php.ini file, find the relevant settings (the following figure), change on to off, you can block errors (this method is not recommended):

 

Sometimes it is not possible to modify the php.ini of the dispaly_errors, then refer to the following method:

Modify PHP.ini, change display_errors = on to display_errors = off, and the result is not. Baidu, the original also to be set in the php-fpm.conf.

Open php-fpm.conf and find:

<value name= "Php_defines" >

</value><value name= "Sendmail_path" >/usr/sbin/sendmail-t-i</value>

<value name= "Display_errors" >0</value>

Change the value from 1 to 0.

3, this method is very applicable to those projects have been decided to use some kind of certain will cause a reminder or warning way, a trick to block, once and for all:

First, refer to 2 to find the location of the associated dispaly_errors, and change off to On

Then find this position below, modify the level you need to error, or do not need to error the level

The error level of the reference is as follows:

If the parameter level is not specified, the current error levels are returned. The following items are level possible values:  

1 e_error 
2 e_warning 
4 e_parse 
8 e_notice 
E_ CORE_ERROR&NBSP
e_core_warning 
e_compile_error 
128 e_compile_warning 
256 E_ USER_ERROR&NBSP
e_user_warning 
1024 e_user_notice 
2047 e_all 
2048 e_strict &NBSP
E_notice indicates that the general situation is not logged and is used only if the program has an error condition, such as attempting to access a nonexistent variable, or calling a stat () function to view a file that does not exist.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.