PHP.ini configuration in a php script file

Source: Internet
Author: User

1, in the script can be configured with the following syntax to configure the php.ini:

Syntax:ini_set ("Set Item Name", value)

For example:ini_set ("Display_errors", false); Do not display all error messages

2. Configure in the php.ini file:

Locate the ER ror_reporting option in the file, such as:

Error_reporting=e_all | E_strict Open All error message prompts (with logical or open meaning), if you want to close some hints again with Error_reporting=e_all | E_strict & ~e_strict ("& ~" means closed)

3,log_error=on;//used to set whether the error log is logged, on record, OFF does not log

4,error_log= "error log file name" //Set the error log file name

such as:error_log = Php_errors.log

5,log_error = syslog; Record error messages in the operating system

6. Custom error Handling

    1. 1, set the name of the custom function used to handle the error;: Set_error_handler ("function name");

  Set_error_handler("Myerror");

2, you define the function, and make any error message output (or record), customize the function with four parameters (parameter name can be changed, but the order cannot be changed, the function does not call itself, but release error will automatically call):function ErrorHandler ($errNo, $ERRMSG, $errFile, $errLine) {...}

function Myerror ($errNo, $ERRMSG, $errFile, $errLine) {

An error occurred on line ($errLine) of the echo "file ($errFile):";

echo "<br/> Error Number: $errNo, error message: $ERRMSG";

}

Echo $vi;

Trigger_error ("Age error, re-entry", e_user_warning);

PHP.ini configuration in a php script file

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.