How to correctly use the PHP ini_set Function

Source: Internet
Author: User

In PHP configuration functions, a function is used to set certain variable values in php. ini. It is the PHP ini_set function that we will introduce to you today.

  • The ini_set function is the value in the setting option. It takes effect after the function is executed and expires when the script ends. Not all options can be changed to function settings. You can set specific values to view the list in the manual.

    You can set the option value in php. ini. For example, if the display_error option is disabled, but you want to display the error information in the program so that you can debug the program, you can use the PHP ini_set function:

       
       
    1. Ini_set ("display_errors
      "," On ");

    The program on your page will display the error information, and you can also use error_reporting to set the displayed error information level.
    If you need to increase the script execution time, you can set:

       
       
    1. Ini_set ("max_execution
      _ Time "," 180 ″);

    Then the script execution time is changed from 30 seconds to 180 seconds by default. Of course, you can also set it using set_time_limit.

    In fact, if you combine the PHP ini_set function with ini_get, it is very good. For example, if you want to add your own include file path in the configuration file, but you have the permission to change php. ini, you can combine the following two functions:

       
       
    1. Ini_set ('include _ Path'
      , Ini_get ('include _ path ').
      ':/Your_include_dir :');


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.