(last updated on )
In your php-fpm.conf
the most important values are:
error_log = /var/log/php/fpm-errors.log
daemonize = yes
And in your php.ini
:
# The most important values:
# Security related
expose_php = Off
# Execution time & memory related
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
# Log related
log_errors = On
error_log = /var/log/php/errors.log
# Upload related
post_max_size = 128M
upload_max_filesize = 64M
max_file_uploads = 10
# Use correct timezone by default
date.timezone = Europe/Berlin
# use strict mode for sessions
session.use_strict_mode = 1
# =========================================
# Production settings
# =========================================
realpath_cache_size = 4M
realpath_cache_ttl = 600
[opcache]
opcache.enable=1
opcache.memory_consumption=256M
opcache.interned_strings_buffer=24
opcache.max_accelerated_files=25000
opcache.use_cwd=0
opcache.validate_timestamps=0
opcache.revalidate_path=0
opcache.save_comments=1
opcache.enable_file_override=1
Pool Config
For servers with a single projects.
The most important settings are:
[example.org]
user = example_org # Use project user + group
group = example_org
listen = 127.0.0.1:9100 # number consecutively
listen.allowed_clients = 127.0.0.1
pm = ondemand
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.process_idle_timeout = 10s
pm.max_requests = 500
catch_workers_output = yes
php_admin_value[error_log] = /var/log/php/$pool-errors.log
php_admin_flag[log_errors] = on
Pool Config (shared server)
For servers with a single project.
The most important settings are:
[example-org]
user = www-data
group = www-data
listen = 127.0.0.1:9100 # number consecutively
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.process_idle_timeout = 10s
pm.max_requests = 500
catch_workers_output = yes
php_admin_value[error_log] = /var/log/php/$pool-errors.log
php_admin_flag[log_errors] = on