Skip to content

Instantly share code, notes, and snippets.

@zkenstein
Created February 24, 2021 12:01
Show Gist options
  • Save zkenstein/5323d79c6ad1f6908d11998627364a28 to your computer and use it in GitHub Desktop.
Save zkenstein/5323d79c6ad1f6908d11998627364a28 to your computer and use it in GitHub Desktop.
Optimized php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; http://php.net/engine
engine = On
; http://php.net/short-open-tag
short_open_tag = Off
; http://php.net/asp-tags
asp_tags = Off
; http://php.net/precision
precision = 14
; http://php.net/y2k-compliance
y2k_compliance = On
; http://php.net/output-buffering
output_buffering = 4096
; http://php.net/zlib.output-compression
zlib.output_compression = Off
; http://php.net/zlib.output-compression-level
;zlib.output_compression_level = -1
; http://php.net/zlib.output-handler
;zlib.output_handler =
; Implicit flush tells PHP to tell the output layer to flush itself
; automatically after every output block.
implicit_flush = Off
; When floats & doubles are serialized store serialize_precision significant
; digits after the floating point. The default value ensures that when floats
; are decoded with unserialize, the data will remain the same.
serialize_precision = 17
; http://php.net/allow-call-time-pass-reference
allow_call_time_pass_reference = Off
; http://php.net/safe-mode
safe_mode = Off
; http://php.net/expose-php
expose_php = On
; http://php.net/max-execution-time
max_execution_time = 30
; http://php.net/max-input-time
max_input_time = 60
; http://php.net/memory-limit
memory_limit = 128M
; http://php.net/error-reporting
error_reporting = E_ALL | E_STRICT
; http://php.net/display-errors
display_errors = On
; http://php.net/display-startup-errors
display_startup_errors = On
; http://php.net/log-errors
log_errors = On
; http://php.net/log-errors-max-len
log_errors_max_len = 1024
; http://php.net/ignore-repeated-errors
ignore_repeated_errors = Off
; http://php.net/ignore-repeated-source
ignore_repeated_source = Off
; http://php.net/report-memleaks
report_memleaks = On
; http://php.net/track-errors
track_errors = On
; http://php.net/html-errors
html_errors = On
; http://php.net/error-prepend-string
error_prepend_string = "<span style='color: #ff0000'><pre>"
; http://php.net/error-append-string
error_append_string = "</pre></span>"
; http://php.net/variables-order
variables_order = "GPCS"
; http://php.net/request-order
request_order = "GP"
; http://php.net/register-globals
register_globals = Off
; http://php.net/register-long-arrays
register_long_arrays = Off
; http://php.net/register-argc-argv
register_argc_argv = Off
; http://php.net/auto-globals-jit
auto_globals_jit = On
; http://php.net/post-max-size
post_max_size = 128M
; http://php.net/magic-quotes-gpc
magic_quotes_gpc = Off
; http://php.net/magic-quotes-runtime
magic_quotes_runtime = Off
; http://php.net/magic-quotes-sybase
magic_quotes_sybase = Off
; http://php.net/default-mimetype
default_mimetype = "text/html"
; http://php.net/include-path
;include_path = ".:/php/includes"
; http://php.net/enable-dl
enable_dl = Off
; http://php.net/cgi.force-redirect
;cgi.force_redirect = 1
; http://php.net/file-uploads
file_uploads = On
; http://php.net/upload-max-filesize
upload_max_filesize = 128M
max_file_uploads = 20
; http://php.net/allow-url-fopen
allow_url_fopen = On
; http://php.net/allow-url-include
allow_url_include = Off
; http://php.net/default-socket-timeout
default_socket_timeout = 60
; http://php.net/auto-detect-line-endings
auto_detect_line_endings = On
[Date]
; http://php.net/date.timezone
date.timezone = America/Denver
[Pdo_mysql]
; http://php.net/pdo_mysql.cache_size
pdo_mysql.cache_size = 2000
[Syslog]
; http://php.net/define-syslog-variables
define_syslog_variables = Off
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On
[SQL]
; http://php.net/sql.safe-mode
sql.safe_mode = Off
[ODBC]
; http://php.net/odbc.allow-persistent
odbc.allow_persistent = On
; http://php.net/odbc.check-persistent
odbc.check_persistent = On
; http://php.net/odbc.max-persistent
odbc.max_persistent = -1
; http://php.net/odbc.max-links
odbc.max_links = -1
; http://php.net/odbc.defaultlrl
odbc.defaultlrl = 4096
; http://php.net/odbc.defaultbinmode
odbc.defaultbinmode = 1
;birdstep.max_links = -1
[Interbase]
; Allow or prevent persistent links.
ibase.allow_persistent = 1
; Maximum number of persistent links. -1 means no limit.
ibase.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
ibase.max_links = -1
; Default timestamp format.
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
; Default date format.
ibase.dateformat = "%Y-%m-%d"
; Default time format.
ibase.timeformat = "%H:%M:%S"
[MySQL]
; http://php.net/mysql.allow_local_infile
mysql.allow_local_infile = On
; http://php.net/mysql.allow-persistent
mysql.allow_persistent = On
; http://php.net/mysql.cache_size
mysql.cache_size = 2000
; http://php.net/mysql.max-persistent
mysql.max_persistent = -1
; http://php.net/mysql.max-links
mysql.max_links = -1
; http://php.net/mysql.connect-timeout
mysql.connect_timeout = 60
; http://php.net/mysql.trace-mode
mysql.trace_mode = Off
[MySQLi]
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1
; http://php.net/mysqli.max-links
mysqli.max_links = -1
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000
; Allow or prevent reconnect
mysqli.reconnect = Off
[mysqlnd]
; http://php.net/mysqlnd.collect_statistics
mysqlnd.collect_statistics = On
; http://php.net/mysqlnd.collect_memory_statistics
mysqlnd.collect_memory_statistics = On
[PostgresSQL]
; http://php.net/pgsql.allow-persistent
pgsql.allow_persistent = On
; http://php.net/pgsql.auto-reset-persistent
pgsql.auto_reset_persistent = Off
; http://php.net/pgsql.max-persistent
pgsql.max_persistent = -1
; http://php.net/pgsql.max-links
pgsql.max_links = -1
; http://php.net/pgsql.ignore-notice
pgsql.ignore_notice = 0
; http://php.net/pgsql.log-notice
pgsql.log_notice = 0
[Sybase-CT]
; http://php.net/sybct.allow-persistent
sybct.allow_persistent = On
; http://php.net/sybct.max-persistent
sybct.max_persistent = -1
; http://php.net/sybct.max-links
sybct.max_links = -1
; http://php.net/sybct.min-server-severity
sybct.min_server_severity = 10
; http://php.net/sybct.min-client-severity
sybct.min_client_severity = 10
[bcmath]
; http://php.net/bcmath.scale
bcmath.scale = 0
[Session]
; http://php.net/session.save-handler
session.save_handler = files
; Whether to use cookies.
; http://php.net/session.use-cookies
session.use_cookies = 1
; http://php.net/session.use-only-cookies
session.use_only_cookies = 1
; http://php.net/session.name
session.name = PHPSESSID
; http://php.net/session.auto-start
session.auto_start = 0
; http://php.net/session.cookie-lifetime
session.cookie_lifetime = 0
; http://php.net/session.cookie-path
session.cookie_path = /
; http://php.net/session.serialize-handler
session.serialize_handler = php
; http://php.net/session.gc-probability
session.gc_probability = 1
; http://php.net/session.gc-divisor
session.gc_divisor = 1000
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 1440
; http://php.net/session.bug-compat-42
session.bug_compat_42 = On
; http://php.net/session.bug-compat-warn
session.bug_compat_warn = On
; http://php.net/session.entropy-length
session.entropy_length = 0
; http://php.net/session.cache-limiter
session.cache_limiter = nocache
; http://php.net/session.cache-expire
session.cache_expire = 180
; http://php.net/session.use-trans-sid
session.use_trans_sid = 0
; http://php.net/session.hash-function
session.hash_function = 0
; http://php.net/session.hash-bits-per-character
session.hash_bits_per_character = 5
; http://php.net/url-rewriter.tags
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = On
; Maximum number of persistent links. -1 means no limit.
mssql.max_persistent = -1
; Maximum number of links (persistent+non persistent). -1 means no limit.
mssql.max_links = -1
; Minimum error severity to display.
mssql.min_error_severity = 10
; Minimum message severity to display.
mssql.min_message_severity = 10
; Compatibility mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
; Use NT authentication when connecting to the server
mssql.secure_connection = Off
[Tidy]
; http://php.net/tidy.clean-output
tidy.clean_output = Off
[soap]
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=1
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"
; http://php.net/soap.wsdl-cache-ttl
soap.wsdl_cache_ttl=86400
; Sets the size of the cache limit. (Max. number of WSDL files to cache)
soap.wsdl_cache_limit = 5
[ldap]
; Sets the maximum number of open links or -1 for unlimited.
ldap.max_links = -1
;;;;;;;;;;;;;;;;;;
;;;;EXTENSIONS;;;;
;;;;;;;;;;;;;;;;;;
; extension=example.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment