PHP Manual
Prev |  | Next

# ini_set

(PHP 4 >= 4.0.0)

ini_set -- Set the value of a configuration option

## Description

``string ini_set` (string varname, string newvalue)`

Sets the value of the given configuration option. Returns the old value on success, `FALSE` on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.

Not all the available options can be changed using ini_set(). Below is a table with a list of all PHP options (as of PHP 4.0.5-dev), indicating which ones can be changed/set and at what level.

Table 1. Configuration options

Name | Default | Changeable
--- | --- | ---
define_syslog_variables | "0" | PHP_INI_ALL
highlight.bg | HL_BG_COLOR | PHP_INI_ALL
highlight.comment | HL_COMMENT_COLOR | PHP_INI_ALL
highlight.default | HL_DEFAULT_COLOR | PHP_INI_ALL
highlight.html | HL_HTML_COLOR | PHP_INI_ALL
highlight.keyword | HL_KEYWORD_COLOR | PHP_INI_ALL
highlight.string | HL_STRING_COLOR | PHP_INI_ALL
allow_call_time_pass_reference | "1" | PHP_INI_SYSTEM|PHP_INI_PERDIR
asp_tags | "0" | PHP_INI_SYSTEM|PHP_INI_PERDIR
display_errors | "1" | PHP_INI_ALL
display_startup_errors | "0" | PHP_INI_ALL
enable_dl | "1" | PHP_INI_SYSTEM
error_append_string | `NULL` | PHP_INI_ALL
error_prepend_string | `NULL` | PHP_INI_ALL
expose_php | "1" | PHP_INI_SYSTEM
html_errors | "1" | PHP_INI_SYSTEM
ignore_user_abort | "0" | PHP_INI_ALL
implicit_flush | "0" | PHP_INI_PERDIR|PHP_INI_SYSTEM
log_errors | "0" | PHP_INI_ALL
magic_quotes_gpc | "1" | PHP_INI_PERDIR|PHP_INI_SYSTEM
magic_quotes_runtime | "0" | PHP_INI_ALL
magic_quotes_sybase | "0" | PHP_INI_PERDIR|PHP_INI_SYSTEM
output_buffering | "0" | PHP_INI_PERDIR|PHP_INI_SYSTEM
output_handler | `NULL` | PHP_INI_PERDIR|PHP_INI_SYSTEM
register_argc_argv | "1" | PHP_INI_ALL
register_globals | "1" | PHP_INI_PERDIR|PHP_INI_SYSTEM
safe_mode | "0" | PHP_INI_SYSTEM
short_open_tag | "1" | PHP_INI_SYSTEM|PHP_INI_PERDIR
sql.safe_mode | "0" | PHP_INI_SYSTEM
track_errors | "0" | PHP_INI_ALL
y2k_compliance | "0" | PHP_INI_ALL
arg_separator | "&" | PHP_INI_ALL
auto_append_file | `NULL` | PHP_INI_ALL
auto_prepend_file | `NULL` | PHP_INI_ALL
doc_root | `NULL` | PHP_INI_SYSTEM
default_charset | SAPI_DEFAULT_CHARSET | PHP_INI_ALL
default_mimetype | SAPI_DEFAULT_MIMETYPE | PHP_INI_ALL
error_log | `NULL` | PHP_INI_ALL
extension_dir | PHP_EXTENSION_DIR | PHP_INI_SYSTEM
gpc_order | "GPC" | PHP_INI_ALL
include_path | PHP_INCLUDE_PATH | PHP_INI_ALL
max_execution_time | "30" | PHP_INI_ALL
open_basedir | `NULL` | PHP_INI_SYSTEM
safe_mode_exec_dir | "1" | PHP_INI_SYSTEM
upload_max_filesize | "2M" | PHP_INI_ALL
file_uploads | "1" | PHP_INI_ALL
post_max_size | "8M" | PHP_INI_SYSTEM
upload_tmp_dir | `NULL` | PHP_INI_SYSTEM
user_dir | `NULL` | PHP_INI_SYSTEM
variables_order | `NULL` | PHP_INI_ALL
SMTP | "localhost" | PHP_INI_ALL
browscap | `NULL` | PHP_INI_SYSTEM
error_reporting | `NULL` | PHP_INI_ALL
memory_limit | "8M" | PHP_INI_ALL
precision | "14" | PHP_INI_ALL
sendmail_from | `NULL` | PHP_INI_ALL
sendmail_path | DEFAULT_SENDMAIL_PATH | PHP_INI_SYSTEM
disable_functions | "" | PHP_INI_SYSTEM
allow_url_fopen | "1" | PHP_INI_ALL

Table 2. Definition of PHP_INI_* constants

Constant | Value | Meaning
--- | --- | ---
PHP_INI_USER | 1 | Entry can be set in user scripts
PHP_INI_PERDIR | 2 | Entry can be set in `.htaccess`
PHP_INI_SYSTEM | 4 | Entry can be set in `php.ini` or `httpd.conf`
PHP_INI_ALL | 7 | Entry can be set anywhere

See also ini_alter(), ini_get(), ini_restore()

Prev | Home | Next
ini_restore | Up | phpcredits