PHP sets display error message and execution time via Ini_set ()

Source: Internet
Author: User

PHP's Ini_set function is the value in the SET option, which takes effect after executing the function, and this setting fails at the end of the script. Not all options can be changed by the function set. The specific values can be set and the list in the manual can be viewed.

is the ability to set the option values in the php.ini for example, the Display_error option is off, but you want to display the error message in the program, so that you can debug the program, then use the PHP ini_set function:

Ini_set ("Display_errors", "on");

Then the program on your page will display an error message, and you can also use error_reporting to set the level of error messages displayed.

If you need to increase the script execution time, you can set:

Ini_set ("Max_execution_time",  "180");

Then the script execution time is changed from the default of 30 seconds to 180 seconds, of course, you can also use Set_time_limit () to set.

In fact, you put PHP ini_set function and ini_get combination so that, very good. For example, if you want to add your own file path to the config file, but you have no permission to change php.ini, you can combine two functions:

Ini_set (' include_path ',  ini_get (' include_path '). ':/your_include_dir: ');

PHP sets display error message and execution time via Ini_set ()

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.