Home > Article > Backend Development > php ini_set ini_get configuration parameter list_PHP tutorial
参数列表如下
name | default | changeable |
---|---|---|
com.allow_dcom | "0" | php教程_ini_system |
com.autoregister_typelib | "0" | php_ini_system |
com.autoregister_verbose | "0" | php_ini_system |
com.autoregister_casesensitive | "1" | php_ini_system |
com.typelib_file | "" | php_ini_system |
crack.default_dictionary | null | php_ini_system |
exif.encode_unicode | "iso-8859-15" | php_ini_all |
exif.decode_unicode_motorola | "ucs-2be" | php_ini_all |
exif.decode_unicode_intel | "ucs-2le" | php_ini_all |
exif.encode_jis | "" | php_ini_all |
exif.decode_jis_motorola | "jis" | php_ini_all |
exif.decode_jis_intel | "jis" | php_ini_all |
fbsql.allow_persistent | "1" | php_ini_system |
fbsql.generate_warnings | "0" | php_ini_system |
fbsql.autocommit | "1" | php_ini_system |
fbsql.max_persistent | "-1" | php_ini_system |
fbsql.max_links | "128" | php_ini_system |
fbsql.max_connections | "128" | php_ini_system |
fbsql.max_results | "128" | php_ini_system |
fbsql.batchsize | "1000" | php_ini_system |
fbsql.default_host | null | php_ini_system |
fbsql.default_user | "_system" | php_ini_system |
fbsql.default_password | "" | php_ini_system |
fbsql.default_database | "" | php_ini_system |
fbsql.default_database_password | "" | php_ini_system |
hwapi.allow_persistent | "0" | php_ini_system |
hyperwave.allow_persistent | "0" | php_ini_system |
hyperwave.default_port | "418" | php_ini_all |
iconv.input_encoding | iconv_input_encoding | php_ini_all |
iconv.output_encoding | iconv_output_encoding | php_ini_all |
iconv.internal_encoding | iconv_internal_encoding | php_ini_all |
ifx.allow_persistent | "1" | php_ini_system |
ifx.max_persistent | "-1" | php_ini_system |
ifx.max_links | "-1" | php_ini_system |
ifx.default_host | null | php_ini_system |
ifx.default_user | null | php_ini_system |
ifx.default_password | null | php_ini_system |
ifx.blobinfile | "1" | php_ini_all |
ifx.textasvarchar | "0" | php_ini_all |
ifx.byteasvarchar | "0" | php_ini_all |
ifx.charasvarchar | "0" | php_ini_all |
ifx.nullformat | "0" | php_ini_all |
ingres.allow_persistent | "1" | php_ini_system |
ingres.max_persistent | "-1" | php_ini_system |
ingres.max_links | "-1" | php_ini_system |
ingres.default_database | null | php_ini_all |
ingres.default_user | null | php_ini_all |
ingres.default_password | null | php_ini_all |
ibase.allow_persistent | "1" | php_ini_system |
ibase.max_persistent | "-1" | php_ini_system |
ibase.max_links | "-1" | php_ini_system |
ibase.default_user | null | php_ini_all |
ibase.default_password | null | php_ini_all |
ibase.timestampformat | "%m/%d/%y%h:%m:%s" | php_ini_all |
ibase.dateformat | "%m/%d/%y" | php_ini_all |
ibase.timeformat | "%h:%m:%s" | php_ini_all |
java.class.path | null | php_ini_all |
java.home | null | php_ini_all |
java.library.path | null | php_ini_all |
java.library | javalib | php_ini_all |
java.library | null | php_ini_all |
ldap.max_links | "-1" | php_ini_system |
mbstring.detect_order | null | php_ini_all |
mbstring.http_input | null | php_ini_all |
mbstring.http_output | null | php_ini_all |
mbstring.internal_encoding | null | php_ini_all |
mbstring.substitute_character | null | php_ini_all |
mbstring.func_overload | "0" | php_ini_system |
mcrypt.algorithms_dir | null | php_ini_all |
mcrypt.modes_dir | null | php_ini_all |
mime_magic.magicfile | "/usr/share/misc/magic.mime" | php_ini_system |
mssql.allow_persistent | "1" | php_ini_system |
mssql.max_persistent | "-1" | php_ini_system |
mssql.max_links | "-1" | php_ini_system |
mssql.max_procs | "25" | php_ini_all |
mssql.min_error_severity | "10" | php_ini_all |
mssql.min_message_severity | "10" | php_ini_all |
mssql.compatability_mode | "0" | php_ini_all |
mssql.connect_timeout | "5" | php_ini_all |
mssql.timeout | "60" | php_ini_all |
mssql.textsize | "-1" | php_ini_all |
mssql.textlimit | "-1" | php_ini_all |
mssql.batchsize | "0" | php_ini_all |
mssql.datetimeconvert | "1" | php_ini_all |
mssql.secure_connection | "0" | php_ini_system |
mysql教程.allow_persistent | "1" | php_ini_system |
mysql.max_persistent | "-1" | php_ini_system |
mysql.max_links | "-1" | php_ini_system |
mysql.default_host | null | php_ini_all |
mysql.default_user | null | php_ini_all |
mysql.default_password | null | php_ini_all |
mysql.default_port | null | php_ini_all |
mysql.default_socket | null | php_ini_all |
ncurses.value | "42" | php_ini_all |
ncurses.string | "foobar" | php_ini_all |
odbc.allow_persistent | "1" | php_ini_system |
odbc.max_persistent | "-1" | php_ini_system |
odbc.max_links | "-1" | php_ini_system |
odbc.default_db | null | php_ini_all |
odbc.default_user | null | php_ini_all |
odbc.default_pw | null | php_ini_all |
odbc.defaultlrl | "4096" | php_ini_all |
odbc.defaultbinmode | "1" | php_ini_all |
odbc.check_persistent | "1" | php_ini_system |
pfpro.defaulthost | "test.signio.com" | |
pfpro.defaulthost | "test-payflow.verisign.com" | |
pfpro.defaultport | "443" | php_ini_all |
pfpro.defaulttimeout | "30" | php_ini_all |
pfpro.proxyaddress | "" | php_ini_all |
pfpro.proxyport | "" | php_ini_all |
pfpro.proxylogon | "" | php_ini_all |
pfpro.proxypassword | "" | php_ini_all |
pgsql.allow_persistent | "1" | php_ini_system |
pgsql.max_persistent | "-1" | php_ini_system |
pgsql.max_links | "-1" | php_ini_system |
pgsql.auto_reset_persistent | "0" | php_ini_system |
pgsql.ignore_notice | "0" | php_ini_all |
pgsql.log_notice | "0" | php_ini_all |
session.save_path | "/tmp" | php_ini_all |
session.name | "phps教程essid" | php_ini_all |
session.save_handler | "files" | php_ini_all |
session.auto_start | "0" | php_ini_all |
session.gc_probability | "1" | php_ini_all |
session.gc_divisor | "100" | php_ini_all |
session.gc_maxlifetime | "1440" | php_ini_all |
session.serialize_handler | "php" | php_ini_all |
session.cookie_lifetime | "0" | php_ini_all |
session.cookie_path | "/" | php_ini_all |
session.cookie_domain | "" | php_ini_all |
session.cookie_secure | "" | php_ini_all |
session.use_cookies | "1" | php_ini_all |
session.use_only_cookies | "0" | php_ini_all |
session.referer_check | "" | php_ini_all |
session.entropy_file | "" | php_ini_all |
session.entropy_length | "0" | php_ini_all |
session.cache_limiter | "nocache" | php_ini_all |
session.cache_expire | "180" | php_ini_all |
session.use_trans_sid | "0" | php_ini_system php_ini_perdir |
session.encode_sources | "globals,track" | php_ini_all |
assert.active | "1" | php_ini_all |
assert.bail | "0" | php_ini_all |
assert.warning | "1" | php_ini_all |
assert.callback | null | php_ini_all |
assert.quiet_eval | "0" | php_ini_all |
safe_mode_protected_env_vars | safe_mode_protected_env_vars | php_ini_system |
safe_mode_allowed_env_vars | safe_mode_allowed_env_vars | php_ini_system |
url_rewriter.tags | "a=href,area=href, frame=src, form=fakeentry" |
php_ini_all |
sybct.allow_persistent | "1" | php_ini_system |
sybct.max_persistent | "-1" | php_ini_system |
sybct.max_links | "-1" | php_ini_system |
sybct.min_server_severity | "10" | php_ini_all |
sybct.min_client_severity | "10" | php_ini_all |
sybct.hostname | null | php_ini_all |
vpopmail.directory | "" | php_ini_all |
zlib.output_compression | "0" | php_ini_system php_ini_perdir |
zlib.output_compression_level | "-1" | php_ini_all |
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 |
expose_php | "1" | php_ini_system |
html_errors | "1" | php_ini_all |
xmlrpc_errors | "0" | php_ini_system |
xmlrpc_error_number | "0" | php_ini_all |
ignore_user_abort | "0" | php_ini_all |
implicit_flush | "0" | php_ini_all |
log_errors | "0" | php_ini_all |
log_errors_max_len | "1024" | php_ini_all |
ignore_repeated_errors | "0" | php_ini_all |
ignore_repeated_source | "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_all |
output_buffering | "0" | php_ini_perdir php_ini_system |
output_handler | null | php_ini_perdir php_ini_system |
register_argc_argv | "1" | php_ini_perdir php_ini_system |
register_globals | "0" | php_ini_perdir php_ini_system |
safe_mode | "1" | php_ini_system |
safe_mode | "0" | php_ini_system |
safe_mode_include_dir | null | php_ini_system |
safe_mode_gid | "0" | php_ini_system |
short_open_tag | default_short_open_tag | 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 |
unserialize_callback_func | null | php_ini_all |
arg_separator.output | "&" | php_ini_all |
arg_separator.input | "&" | php_ini_system php_ini_perdir |
auto_append_file | null | php_ini_system php_ini_perdir |
auto_prepend_file | null | php_ini_system php_ini_perdir |
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_system php_ini_perdir |
file_uploads | "1" | php_ini_system |
post_max_size | "8m" | php_ini_system php_ini_perdir |
upload_tmp_dir | null | php_ini_system |
user_dir | null | php_ini_system |
variables_order | null | php_ini_all |
error_append_string | null | php_ini_all |
error_prepend_string | null | php_ini_all |
smtp | "localhost" | php_ini_all |
smtp_port | 25 | 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_classes | "" | php.ini only |
disable_functions | "" | php.ini only |
allow_url_fopen | "1" | php_ini_all |
always_populate_raw_post_data | "0" | php_ini_system php_ini_perdir |
xbithack | "0" | php_ini_all |
engine | "1" | php_ini_all |
last_modified | "0" | php_ini_all |
child_terminate | "0" | php_ini_all |
async_send | "0" | php_ini_all |
The operable range is shown in the table below:
operating range constant | value | meaning |
---|---|---|
php_ini_user | 1 | entry can be set in user scripts |
php_ini_perdir | 2 | entry can be set in php.ini, .htaccess or httpd.conf |
php_ini_system | 4 | entry can be set in php.ini or httpd.conf |
php_ini_all | 7 | entry can be set anywhere |
常量 | 值 | 含义 |
---|---|---|
php_ini_user | 1 | 该项目可以在用户脚本中设定 |
php_ini_perdir | 2 | 该项目可以在 php.ini ,.htaccess 或者 httpd.conf 中设定 |
php_ini_system | 4 | 该项目可以在 php.ini 或 httpd.conf 中设定 |
php_ini_all | 7 | 该项目可以在任何地方设定 |
ini_set ini_get list of operable configuration parameters
Get the magic_quotes_gpc status to determine whether we escape (addslashes) the data when the form is submitted;
Set max_execution_time to extend the execution time of the program;
Set error_reporting to switch your project between the development and operation phases;
Set memory_limit to increase memory, etc...
view sourceprint?1 ini_set (string varname, string newvalue): //Set the parameters of the environment configuration
2 ini_get (string varname): //Get the parameters of the environment configuration
The php ini_set function is to set the value in the option. It takes effect after the function is executed. When the script ends, this setting also becomes invalid. Not all options can be set by the function. The specific values that can be set can be viewed in the manual for a list.
You can set the option value in php.ini. For example, if the display_error option is turned off, but you want to display the error message in the program to facilitate your debugging of the program, then you can use the php ini_set function:
view sourceprint?1 ini_set ( 'display_errors' , 'on' );
Then the program on your page will display error information, and you can also use error_reporting to set the level of error information displayed.
If you need to increase the script execution time, you can set:
view sourceprint?1 ini_set('max_execution_time', '180');
Then the script execution time changes from the default 30 seconds to 180 seconds. Of course, you can also use set_time_limit() to set it.
Actually, it is very good if you combine the php ini_set function with ini_get. For example, if you want to add your own include file path to the configuration file, but do you have permission to change php.ini, then you can combine two functions:
view sourceprint?1 ini_set ( 'include_path' , ini_get ( 'include_path' ). ':/your_include_dir:' );
I believe many people have used the PHP configuration function ini_get(), which is to get the value of an option in the configuration file. If it is a true value, it returns 1, if it is a false value, it returns 0, and if it is a false value, it returns a string.
For example, the example in the manual:
view sourceprint?1
2 /* our php.ini contains the following settings: display_errors = on register_globals = off post_max_size = 8m */
3
4 echo 'display_errors = ' . ini_get ( 'display_errors' ) . " " ; //Whether error display is on or not
5 echo 'register_globals = ' . ini_get ( 'register_globals' ) . " " ; //Whether global variables are open or not
6 echo 'post_max_size = ' . ini_get ( 'post_max_size' ) . " " ; //The maximum file size that can be submitted
7 echo 'post_max_size+1 = ' . ( ini_get ( 'post_max_size' )+1) . " " ;
8
9 ?>
Output:
display_errors = 1
register_globals = 0
post_max_size = 8m
post_max_size+1 = 9
PHP configuration function ini_get() is mainly used to obtain configuration files, which can facilitate many operations for you. For example, you want to operate string filtering, but you don’t know whether magic_quotes_gpc is turned on, so you can write a function like this:
view sourceprint?1
2 /* String filter function */
3 function stringfilter( $str ) {
4 if ( ini_get ( 'magic_quotes_gpc)' ) { return $str ; } else { return addslashes ( $str ); }
5 }
6 ?>
Of course, if you have no way of knowing whether your global variable is open, you can also customize a function like this:
view sourceprint?1
2 /* Variable detection function */
3 function getgetvar( $var ) {
4 if ( ini_set ( 'register_gobals' )){ return $var ; } else { return $_get [ 'var' ]; }
5 }
6 ?>
Of course, you can use the php configuration function ini_get() for many purposes