ini_set

(PHP 4 >= 4.0RC1)

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.

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

NameDefaultChangeable
define_syslog_variables"0"PHP_INI_ALL
highlight.bgHL_BG_COLORPHP_INI_ALL
highlight.commentHL_COMMENT_COLORPHP_INI_ALL
highlight.defaultHL_DEFAULT_COLORPHP_INI_ALL
highlight.htmlHL_HTML_COLORPHP_INI_ALL
highlight.keywordHL_KEYWORD_COLORPHP_INI_ALL
highlight.stringHL_STRING_COLORPHP_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_stringNULLPHP_INI_ALL
error_prepend_stringNULLPHP_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_ALL
magic_quotes_runtime"0"PHP_INI_ALL
magic_quotes_sybase"0"PHP_INI_ALL
output_buffering"0"PHP_INI_PERDIR|PHP_INI_SYSTEM
output_handlerNULLPHP_INI_PERDIR|PHP_INI_SYSTEM
register_argc_argv"1"PHP_INI_ALL
register_globals"1"PHP_INI_ALL
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_fileNULLPHP_INI_ALL
auto_prepend_fileNULLPHP_INI_ALL
doc_rootNULLPHP_INI_SYSTEM
default_charsetSAPI_DEFAULT_CHARSETPHP_INI_ALL
default_mimetypeSAPI_DEFAULT_MIMETYPEPHP_INI_ALL
error_logNULLPHP_INI_ALL
extension_dirPHP_EXTENSION_DIRPHP_INI_SYSTEM
gpc_order"GPC"PHP_INI_ALL
include_pathPHP_INCLUDE_PATHPHP_INI_ALL
max_execution_time"30"PHP_INI_ALL
open_basedirNULLPHP_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_dirNULLPHP_INI_SYSTEM
user_dirNULLPHP_INI_SYSTEM
variables_orderNULLPHP_INI_ALL
SMTP"localhost"PHP_INI_ALL
browscapNULLPHP_INI_SYSTEM
error_reportingNULLPHP_INI_ALL
memory_limit"8M"PHP_INI_ALL
precision"14"PHP_INI_ALL
sendmail_fromNULLPHP_INI_ALL
sendmail_pathDEFAULT_SENDMAIL_PATHPHP_INI_SYSTEM
disable_functions""PHP_INI_SYSTEM
allow_url_fopen"1"PHP_INI_ALL

Table 2. Definition of PHP_INI_* constants

ConstantValueMeaning
PHP_INI_USER1Entry can be set in user scripts
PHP_INI_PERDIR2Entry can be set in .htaccess
PHP_INI_SYSTEM4Entry can be set in php.ini or httpd.conf
PHP_INI_ALL7Entry can be set anywhere

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