Configuration

Environment variables

The complete reference for every variable, grouped by image and area.

All runtime configuration is done through environment variables, rendered into configuration files at container start. Variables set on a parent image are inherited by its children, so the php variables work on php-nginx and php-nginx-dev too.

Beyond the named variables below, any php.ini or PHP-FPM setting can be set with the php.<setting>, fpm.pool.<setting> and fpm.global.<setting> prefixes. See PHP settings.

All images (from base)

VariableDefaultDescription
LOG_MODEstdoutstdout streams everything to the container, tagged per service. file writes one file per service under /var/log.
LOG_FORMATtexttext for [service]-prefixed lines, json for one JSON object per line.
LOG_TAGtruefalse removes the [service] prefixes in text mode.
TZUTCContainer timezone.
LANGC.UTF-8Locale.

php

General

VariableDefaultphp.ini directive
PHP_MEMORY_LIMIT128Mmemory_limit
PHP_UPLOAD_MAX_FILESIZE2Mupload_max_filesize
PHP_POST_MAX_SIZE2Mpost_max_size
PHP_MAX_EXECUTION_TIME30max_execution_time
PHP_MAX_INPUT_TIME60max_input_time
PHP_MAX_INPUT_VARS1000max_input_vars
PHP_DISPLAY_ERRORSOffdisplay_errors
PHP_ERROR_REPORTINGE_ALL & ~E_DEPRECATED & ~E_STRICTerror_reporting
PHP_DATE_TIMEZONEUTCdate.timezone
PHP_SENDMAIL_PATH(PHP default)sendmail_path, for example /usr/bin/msmtp -t

Security

VariableDefaultphp.ini directive
PHP_EXPOSE_PHPOffexpose_php (controls the X-Powered-By header)
PHP_DISABLE_FUNCTIONS(empty)disable_functions
PHP_ALLOW_URL_FOPENOnallow_url_fopen
PHP_ALLOW_URL_INCLUDEOffallow_url_include
PHP_OPEN_BASEDIR(empty)open_basedir, for example /var/www/html:/tmp
PHP_SESSION_COOKIE_HTTPONLYOnsession.cookie_httponly
PHP_SESSION_COOKIE_SECURE(auto)session.cookie_secure. Resolves to On when NGINX_SSL_ENABLED=true, otherwise Off.
PHP_SESSION_COOKIE_SAMESITELaxsession.cookie_samesite
PHP_SESSION_USE_STRICT_MODEOnsession.use_strict_mode
PHP_CGI_FIX_PATHINFO0cgi.fix_pathinfo

OPcache

VariableDefaultphp.ini directive
OPCACHE_ENABLE0opcache.enable
OPCACHE_ENABLE_CLI0opcache.enable_cli
OPCACHE_MEMORY_CONSUMPTION128opcache.memory_consumption
OPCACHE_INTERNED_STRINGS_BUFFER8opcache.interned_strings_buffer
OPCACHE_MAX_ACCELERATED_FILES10000opcache.max_accelerated_files
OPCACHE_VALIDATE_TIMESTAMPS1opcache.validate_timestamps
OPCACHE_REVALIDATE_FREQ2opcache.revalidate_freq
OPCACHE_MAX_WASTED_PERCENTAGE5opcache.max_wasted_percentage
OPCACHE_LOG_VERBOSITY_LEVEL1opcache.log_verbosity_level
OPCACHE_ERROR_LOG/var/log/php-opcache.logopcache.error_log
OPcache is off by default so the image behaves predictably for CLI work and bind-mounted development. Turn it on in production with OPCACHE_ENABLE=1 and, for immutable deployments, OPCACHE_VALIDATE_TIMESTAMPS=0.

Build-time and internals

VariableDescription
PHP_VERSIONMinor without the dot, for example 84. Set at build time; used in package and path names.
PHP_PATCH_VERSIONExact pinned release, for example 8.4.26. Set at build time.
PHPRC/run/php, where the rendered php.ini lives.

php-nginx

Nginx

VariableDefaultDescription
NGINX_PORT80HTTP listen port. Use 8080 or higher when running as non-root.
NGINX_LISTEN_IPV6trueAlso listen on [::]. Set false on hosts with IPv6 disabled in the kernel.
NGINX_SERVER_NAME_server_name. Also fixes the HTTPS redirect target.
NGINX_DOCUMENT_ROOT/var/www/htmlWeb root.
NGINX_FASTCGI_PASS127.0.0.1:9000Upstream for PHP requests.
NGINX_ACCESS_LOG(by LOG_MODE)Access log destination. off disables it.
NGINX_ERROR_LOG(by LOG_MODE)Error log destination for the http block and the app server.

PHP-FPM

VariableDefaultDescription
PHP_FPM_LISTEN127.0.0.1:9000Pool listen address.
PHP_FPM_MAX_CHILDREN30pm.max_children
PHP_FPM_START_SERVERS5pm.start_servers
PHP_FPM_MIN_SPARE_SERVERS3pm.min_spare_servers
PHP_FPM_MAX_SPARE_SERVERS10pm.max_spare_servers
PHP_FPM_MAX_REQUESTS1000pm.max_requests
PHP_FPM_REQUEST_TERMINATE_TIMEOUT0request_terminate_timeout
PHP_FPM_ERROR_LOG(by LOG_MODE)FPM master and pool error log.
PHP_FPM_SLOWLOG(by LOG_MODE)Slow request log (requests over 5 seconds).

SSL and HTTPS

VariableDefaultDescription
NGINX_SSL_ENABLEDfalseMaster switch.
NGINX_SSL_PORT443HTTPS listen port. Use 8443 when running as non-root.
NGINX_SSL_CERTIFICATE/etc/nginx/ssl/cert.pemCertificate path.
NGINX_SSL_CERTIFICATE_KEY/etc/nginx/ssl/key.pemPrivate key path.
NGINX_SSL_PROTOCOLSTLSv1.2 TLSv1.3Allowed TLS versions.
NGINX_SSL_CIPHERSMozilla intermediate listssl_ciphers.
NGINX_SSL_PREFER_SERVER_CIPHERSoffssl_prefer_server_ciphers.
NGINX_SSL_SESSION_CACHEshared:SSL:10mssl_session_cache.
NGINX_SSL_SESSION_TIMEOUT1dssl_session_timeout.
NGINX_SSL_REDIRECTtrueServe an HTTP listener that redirects to HTTPS.
NGINX_SSL_REDIRECT_PORT(inherits NGINX_PORT)Port for the redirect listener.
NGINX_SSL_REDIRECT_HOST(first NGINX_SERVER_NAME)Host used in the redirect Location.
NGINX_SSL_SELF_SIGNEDfalseGenerate a self-signed certificate at startup if none exists.
NGINX_SSL_SELF_SIGNED_CNlocalhostCN and SAN for the generated certificate.
NGINX_SSL_SELF_SIGNED_DAYS365Validity of the generated certificate.
NGINX_SSL_HSTStrueSend Strict-Transport-Security.
NGINX_SSL_HSTS_MAX_AGE63072000HSTS max-age in seconds (two years).

php-nginx-dev

VariableDefaultDescription
PHP_DEBUGGERxdebugxdebug or none.
XDEBUG_MODEdevelop,debugXdebug modes.
XDEBUG_START_WITH_REQUESTtriggeryes, no or trigger.
XDEBUG_CLIENT_HOSThost.docker.internalIDE host.
XDEBUG_CLIENT_PORT9003IDE port.
XDEBUG_DISCOVER_CLIENT_HOSTfalseDerive the IDE host from the request.
XDEBUG_IDEKEYPHPSTORMIDE key.
XDEBUG_OUTPUT_DIR/tmp/xdebugProfiles and traces.
XDEBUG_LOG_LEVEL3Xdebug log level.
NGINX_NO_CACHE_PATTERNasset regexPaths served with no-store. Empty disables.
PHP_INI_SCAN_DIR:/run/php/conf.dAdds the rendered Xdebug ini to PHP's scan path.

The dev image also overrides PHP_DISPLAY_ERRORS=On and PHP_ERROR_REPORTING=E_ALL.