Introduction to the usage of Ini_set

Source: Internet
Author: User

PHP Ini_set is used to set the value of php.ini, which takes effect when the function executes, and the settings expire after the script is finished. You can modify the configuration without opening the php.ini file, which is convenient for virtual space.

function Format: String Ini_set (String $varname, String $newvalue)

Not all parameters can be configured to view the list in the manual.

Common settings:

@ ini_set (' memory_limit ', ' 64M ');

' Menory_limit ': Sets the maximum number of bytes of memory that a script can request, which helps write bad scripts that consume the available memory on the server. The @ symbol means no output error.

@ini_set (' display_errors ', 1);

' Display_errors ': Sets the category of the error message.

@ini_set (' Session.auto_start ', 0);

' Session.auto_start ': whether automatically open session processing, set to 1 o'clock, the program does not have to session_start () to manually open the session can also use the session,

If the parameter is 0 and the session is not manually opened, an error will be added.

@ini_set (' Session.cache_expire ', 180);

' Session.cache_expire ': Specifies a time limit (minutes) for the session page to be saved in the client cache for 180 minutes. If Session.cache_limiter=nocache is set, the settings here are not valid.

@ini_set (' session.use_cookies ', 1);

' Session.use_cookies ': whether to use a cookie to save the session ID on the client;

@ini_set (' Session.use_trans_sid ', 0);

' Session.use_trans_sid ': whether to display the SID (session ID) in the URL using plaintext,

The default is forbidden because it poses a security risk to your users:
1. The user may tell other people about URLs that contain valid SIDS through EMAIL/IRC/QQ/MSN and other means.
2. URLs that contain valid SIDS may be saved on the public computer.
3. Users may save URLs with immutable SIDs in their favorites or browsing history. URL-based session management is always more risky than cookie-based session management, so it should be disabled.

Introduction to the usage of 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.