Name

ini_set()

Synopsis

    string ini_set ( string varname, string value )

The ini_set() function allows you to change system attributes that affect the way your script is executed. Changes only affect the current script, and will revert back when the script ends.

To use ini_set(), pass it the value you want to change as its first parameter, and the new value to use as its second parameter. If it is successful, it will return the previous value. For example:

    print ini_set("max_execution_time", "300") . "<br />";
    print ini_set("display_errors", "0") . "<br />";
    print ini_set("include_path", "/home/paul/include") . "<br />";

Many variables cannot be changed using ini_set(), because they have already been used. For example, magic_quotes_gpc decides whether PHP should automatically send all HTTP input through the addslashes() function before giving it to you. Although you can change this using ini_set(), it is pointless to do so: it will be changed after PHP has already modified the variables.

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.