Skip to content

Instantly share code, notes, and snippets.

@jaeyson
Created October 7, 2025 11:10
Show Gist options
  • Save jaeyson/db512307cf06379b358c8692763d23a9 to your computer and use it in GitHub Desktop.
Save jaeyson/db512307cf06379b358c8692763d23a9 to your computer and use it in GitHub Desktop.
PHP 8 configs
# conf.d/20-mysqli.ini
extension=mysqli.so
[mysql]
mysql.allow_local_infile=On
mysql.allow_persistent=On
mysql.cache_size=2000
mysql.max_persistent=-1
mysql.max_links=-1
mysql.default_port=
mysql.default_socket=/run/mysqld/mysqld.sock
mysql.default_host=
mysql.default_user=
mysql.default_password=
mysql.connect_timeout=60
mysql.trace_mode=Off

Most important changes (==DIFFERENCES) in my php.ini file compared to the default php.ini file. As well as other PHP configuration files (pool.d/www.conf and conf/20-mysqli.ini files). Sharing is caring.

Note: I'm also running a Nextcloud instance, which require larger uploads & higher limits. Look for yourself what your optimal settings are for max_execution_time, post_max_size and upload_max_filesize.

realpath_cache_size = 4096k
realpath_cache_ttl = 600
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 350
max_input_time = 60
max_input_vars = 5800
memory_limit = 1G
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
display_errors = Off
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
post_max_size = 15G
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
upload_max_filesize = 15G
max_file_uploads = 200
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 1024
opcache.interned_strings_buffer = 128
opcache.max_accelerated_files = 100000
opcache.validate_timestamps = 0
;opcache.revalidate_freq = 60
opcache.save_comments = 1
; Enable JIT in PHP
opcache.jit = 1255
opcache.jit_buffer_size = 500M
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Date]
date.timezone = "Europe/Amsterdam"
# pool.d/www.conf
[www]
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 150
pm.start_servers = 30
pm.min_spare_servers = 15
pm.max_spare_servers = 50
; Below is needed for Nextcloud
clear_env = no
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment