Repository navigation
php.ini directives – attempt to standarize notation #17266
Description
Description
Currently there are some writing inconsistencies in php.ini directives. Sometimes there are spaces around equals sign (user_ini.cache_ttl = 300), sometimes not (opcache.enable_cli=0). String values are sometimes inside double quotation marks (docref_root = "/phpmanual/") and sometimes not (mbstring.language = Japanese). Finally, boolean values are most often written as On/Off but sometimes they are written as 1/0 or true/false.
The idea is to standarize notation of directives according to some set of rules. For example:
- equals signs should be surrounded by spaces,
- string values should be surrounded by double quotation marks,
- boolean values should be written as On/Off.
Following the above rules, the list of directives would look like this (values taken from production version of php.ini):
user_ini.filename = ".user.ini"
user_ini.filename = ""
user_ini.cache_ttl = 300
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
output_handler = ""
url_rewriter.tags = "form="
url_rewriter.hosts = ""
zlib.output_compression = Off
zlib.output_compression_level = -1
zlib.output_handler = ""
implicit_flush = Off
unserialize_callback_func = ""
unserialize_max_depth = 4096
serialize_precision = -1
open_basedir = ""
disable_functions = ""
disable_classes = ""
highlight.string = "#DD0000"
highlight.comment = "#FF9900"
highlight.keyword = "#7700"
highlight.default = "#0000BB"
highlight.html = "#000000"
ignore_user_abort = On
realpath_cache_size = 4096k
realpath_cache_ttl = 120
zend.enable_gc = On
zend.multibyte = Off
zend.script_encoding = ""
zend.exception_ignore_args = On
zend.exception_string_param_max_len = 0
expose_php = On
max_execution_time = 30
max_input_time = 60
max_input_nesting_level = 64
max_input_vars = 1000
max_multipart_body_parts = 1500
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = Off
display_startup_errors = Off
log_errors = On
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
report_zend_debug = Off
xmlrpc_errors = Off
xmlrpc_error_number = 0
html_errors = On
docref_root = "/phpmanual/"
docref_ext = ".html"
error_prepend_string = ""
error_append_string = ""
error_log = "php_errors.log"
error_log = "syslog"
syslog.ident = "php"
syslog.facility = "user"
syslog.filter = "ascii"
windows.show_crt_warning = Off
arg_separator.output = "&"
arg_separator.input = ";&"
ariables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
enable_post_data_reading = Off
post_max_size = 8M
auto_prepend_file = ""
auto_append_file = ""
default_mimetype = "text/html"
default_charset = "UTF-8"
internal_encoding = ""
input_encoding = ""
output_encoding = ""
include_path = ".:/php/includes"
include_path = ".;c:\php\includes"
doc_root = ""
user_dir = ""
extension_dir = "./"
extension_dir = "ext"
sys_temp_dir = "/tmp"
enable_dl = Off
cgi.force_redirect = On
cgi.nph = On
cgi.redirect_status_env = ""
cgi.fix_pathinfo = On
cgi.discard_path = On
fastcgi.impersonate = "1"
fastcgi.logging = Off
cgi.rfc2616_headers = 0
cgi.check_shebang_line = On
file_uploads = On
upload_tmp_dir = ""
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
from = "john@doe.com"
user_agent = "PHP"
default_socket_timeout = 60
auto_detect_line_endings = Off
extension = "bz2"
extension = "curl"
extension = "exif"
extension = "ffi"
extension = "ftp"
extension = "fileinfo"
extension = "gd"
extension = "gettext"
extension = "gmp"
extension = "intl"
extension = "ldap"
extension = "mbstring"
extension = "mysqli"
extension = "odbc"
extension = "openssl"
extension = "pdo_firebird"
extension = "pdo_mysql"
extension = "pdo_odbc"
extension = "pdo_pgsql"
extension = "pdo_sqlite"
extension = "pgsql"
extension = "shmop"
extension = "snmp"
extension = "soap"
extension = "sockets"
extension = "sodium"
extension = "sqlite3"
extension = "tidy"
extension = "xsl"
extension = "zip"
zend_extension = "opcache"
date.timezone = ""
date.default_latitude = 31.7667
date.default_longitude = 35.2333
date.sunrise_zenith = 90.833333
date.sunset_zenith = 90.833333
filter.default = "unsafe_raw"
filter.default_flags =
iconv.input_encoding = ""
iconv.internal_encoding = ""
iconv.output_encoding = ""
intl.default_locale = ""
intl.error_level = E_WARNING
intl.use_exceptions = 0
sqlite3.extension_dir = ""
sqlite3.defensive = On
pcre.backtrack_limit = 100000
pcre.recursion_limit = 100000
pcre.jit = On
pdo_odbc.connection_pooling = "strict"
pdo_mysql.default_socket = ""
phar.readonly = On
phar.require_hash = On
phar.cache_list = ""
SMTP = "localhost"
smtp_port = 25
sendmail_from = "me@example.com"
sendmail_path = ""
mail.force_extra_parameters = ""
mail.add_x_header = Off
mail.mixed_lf_and_crlf = Off
mail.log = ""
mail.log = "syslog"
odbc.default_db = ""
odbc.default_user = ""
odbc.default_pw = ""
odbc.default_cursortype = SQL_CURSOR_STATIC
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
mysqli.max_persistent = -1
mysqli.allow_local_infile = 1
mysqli.local_infile_directory = ""
mysqli.allow_persistent = 1
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket = ""
mysqli.default_host = ""
mysqli.default_user = ""
mysqli.default_pw = ""
mysqli.rollback_on_cached_plink = Off
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
mysqlnd.debug = ""
mysqlnd.log_mask = 0
mysqlnd.mempool_default_size = 16000
mysqlnd.net_cmd_buffer_size = 2048
mysqlnd.net_read_buffer_size = 32768
mysqlnd.net_read_timeout = 31536000
mysqlnd.sha256_server_public_key = ""
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = 0
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
bcmath.scale = 0
browscap = "extra/browscap.ini"
session.save_handler = "files"
session.save_path = "/tmp"
session.use_strict_mode = Off
session.use_cookies = On
session.cookie_secure = Off
session.use_only_cookies = On
session.name = "PHPSESSID"
session.auto_start = Off
session.cookie_lifetime = 0
session.cookie_path = "/"
session.cookie_domain = ""
session.cookie_httponly = Off
session.cookie_samesite = ""
session.serialize_handler = "php"
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check = ""
session.cache_limiter = "nocache"
session.cache_expire = 180
session.use_trans_sid = 0
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.trans_sid_hosts = ""
session.upload_progress.enabled = On
session.upload_progress.cleanup = On
session.upload_progress.prefix = "upload_progress_"
session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS"
session.upload_progress.freq = "1%"
session.upload_progress.min_freq = 1
session.lazy_write = On
zend.assertions = -1
com.typelib_file = ""
com.allow_dcom = On
com.autoregister_typelib = On
com.autoregister_casesensitive = Off
com.autoregister_verbose = On
com.code_page = ""
com.dotnet_version = ""
mbstring.language = "Japanese"
mbstring.internal_encoding = ""
mbstring.http_input = ""
mbstring.http_output = ""
mbstring.encoding_translation = Off
mbstring.detect_order = "auto"
mbstring.substitute_character = "none"
mbstring.strict_detection = Off
mbstring.http_output_conv_mimetypes = ""
mbstring.regex_stack_limit = 100000
mbstring.regex_retry_limit = 1000000
gd.jpeg_ignore_warning = On
exif.encode_unicode = "ISO-8859-15"
exif.decode_unicode_motorola = "UCS-2BE"
exif.decode_unicode_intel = "UCS-2LE"
exif.encode_jis = ""
exif.decode_jis_motorola = "JIS"
exif.decode_jis_intel = "JIS"
tidy.default_config = "/usr/local/lib/php/default.tcfg"
tidy.clean_output = Off
soap.wsdl_cache_enabled = 1
soap.wsdl_cache_dir = "/tmp"
soap.wsdl_cache_ttl = 86400
soap.wsdl_cache_limit = 5
sysvshm.init_mem = 10000
ldap.max_links = -1
dba.default_handler = ""
opcache.enable = On
opcache.enable_cli = Off
opcache.memory_consumption = 128
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
opcache.max_wasted_percentage = 5
opcache.use_cwd = On
opcache.validate_timestamps = On
opcache.revalidate_freq = 2
opcache.revalidate_path = Off
opcache.save_comments = On
opcache.record_warnings = Off
opcache.enable_file_override = Off
opcache.optimization_level = 0x7FFFBFFF
opcache.dups_fix = Off
opcache.blacklist_filename = ""
opcache.max_file_size = 0
opcache.force_restart_timeout = 180
opcache.error_log = ""
opcache.log_verbosity_level = 1
opcache.preferred_memory_model = ""
opcache.protect_memory = Off
opcache.restrict_api = ""
opcache.mmap_base = ""
opcache.cache_id = ""
opcache.file_cache = ""
opcache.file_cache_read_only = Off
opcache.file_cache_only = Off
opcache.file_cache_consistency_checks = On
opcache.file_cache_fallback = On
opcache.huge_code_pages = Off
opcache.validate_permission = Off
opcache.validate_root = Off
opcache.opt_debug_level = "0"
opcache.preload = ""
opcache.preload_user = ""
opcache.file_update_protection = 2
opcache.lockfile_path = "/tmp"
curl.cainfo = ""
;openssl.cafile = ""
;openssl.capath = ""
;ffi.enable = "preload"
;ffi.preload = ""
Activity
devnexen commentedon Dec 26, 2024
Hi @diceydust, do you just want to "fix" the php.inis and/or narrowing down ini values accepted by php itself ?
diceydust commentedon Dec 26, 2024
@devnexen changeing these values 'per se' is not my intention. What I care about is the way that they are presented inside php.ini. So it is rather a cosmetic issue, which however is somewhat confusing.
Currently inside php.ini there are lot of inconsistencies, like:
xmlrpc_errors = 0ignore_repeated_source = OffBoth are of a bool type, so why both values are not written as
0? or why both values are not written asOff?From what I understand, for PHP it doesn't matter whether we write:
zlib.output_compression = Offor
zlib.output_compression = 0or
zlib.output_compression = falseSo changeing all booleans according to a chosen notation style shouldn't cause any harm. And for clarity and aesthetic reasons it would better if the notation of the directives was consistent.
devnexen commentedon Dec 26, 2024
Thanks for the clarifications. Would you like to correct all of these yourself through a Pull Request ?
diceydust commentedon Dec 27, 2024
Done: #17282