here is a very nice php.ini for development environment that has also production ready comments:
; php-8.4.dev+prod.php.ini
; Purpose: Developer-friendly php.ini for PHP 8.4 with optional production overrides.
; Distro: Arch Linux (main php ini: /etc/php/php.ini)
; License: MIT — free to use/publish.
;
; This file is organized in two layers:
; - **Development defaults** (active): generous hardware allocations, verbose errors, all extensions enabled.
; - **Production overrides** (commented-out at the bottom): secure, strict, optimized.
;
; Quick install (Arch):
; sudo cp /etc/php/php.ini /etc/php/php.ini.bak
; sudo cp php-8.4.dev+prod.php.ini /etc/php/php.ini
; sudo systemctl restart php-fpm.service
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CORE SETTINGS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
implicit_flush = Off
serialize_precision = -1
; Timezone
date.timezone = "UTC"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ERRORS & LOGGING (DEV FRIENDLY)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
display_errors = On
display_startup_errors = On
error_reporting = E_ALL
log_errors = On
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PERFORMANCE & RESOURCE LIMITS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
memory_limit = 2G
max_execution_time = 300
max_input_time = 300
max_input_vars = 10000
realpath_cache_size = 16384k
realpath_cache_ttl = 1200
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; UPLOADS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
file_uploads = On
upload_max_filesize = 512M
post_max_size = 1024M
max_file_uploads = 50
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; STREAMS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SESSIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
session.save_handler = files
session.use_strict_mode = 1
session.use_cookies = 1
session.use_only_cookies = 1
session.cookie_httponly = 1
session.cookie_samesite = Lax
session.gc_maxlifetime = 28800
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CLI MODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[CLI]
memory_limit = -1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; OPCACHE & JIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 512
opcache.interned_strings_buffer = 64
opcache.max_accelerated_files = 50000
opcache.revalidate_freq = 0
opcache.validate_timestamps = 1
opcache.jit = tracing
opcache.jit_buffer_size = 256M
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; EXTENSIONS (as per your list)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
extension=bcmath
extension=bz2
extension=calendar
extension=curl
extension=dba
;extension=enchant
extension=exif
extension=ffi
extension=ftp
extension=gd
extension=gettext
extension=gmp
extension=iconv
extension=intl
extension=ldap
extension=mysqli
;extension=odbc
zend_extension=opcache
;extension=pdo_dblib
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=sysvmsg
extension=sysvsem
extension=sysvshm
;extension=tidy
;extension=xsl
extension=zip
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; XDEBUG (optional)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;zend_extension = xdebug.so
;xdebug.mode = develop,debug,coverage
;xdebug.start_with_request = trigger
;xdebug.client_host = 127.0.0.1
;xdebug.client_port = 9003
;xdebug.log = "/var/log/php/xdebug.log"
;xdebug.output_dir = "/tmp"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; SECURITY & MISC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
expose_php = Off
html_errors = On
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PRODUCTION OVERRIDES (commented, toggle if deploying)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;display_errors = Off
;display_startup_errors = Off
;error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE
;memory_limit = 512M
;max_execution_time = 60
;max_input_time = 60
;upload_max_filesize = 32M
;post_max_size = 64M
;session.cookie_secure = 1
;session.cookie_samesite = Strict
;opcache.enable = 1
;opcache.enable_cli = 0
;opcache.validate_timestamps = 0
;opcache.revalidate_freq = 60
;zend.assertions = -1
;expose_php = Off
;session.save_path = "/var/lib/php/sessions"
; EOF
enjoy 😀
Leave a Reply