HUB
Sign inSign up
apache24-php-fpm logo

ajoergensen/apache24-php-fpm

By ajoergensen

•Updated 6 days ago

Apache 2.4 and PHP FPM

Image
0

10K+

ajoergensen/apache24-php-fpm repository overview

⁠Apache 2.4 with PHP FPM

An image based on Ubuntu 24.04 with Apache 2.4 and PHP installed from Ondřej Surý's PPAs⁠ for up to date packages.

Images are built for linux/amd64 and linux/arm64/v8.

phpinfo();⁠

⁠Why use this image?
  • Latest PHP and Apache packages
  • Apache and php-fpm is running as user app, fixing a lot of permission headaches
  • UID and GID for user app can be changed (See below)
  • mod_remoteip⁠ is enabled
⁠Limitations

The configuration does not support SSL out of the box as I usually stick nginx⁠ or traefik⁠ in front of any Apache instances I might need.

⁠Usage
⁠Tags

This image is available in four flavors corresponding to the PHP version: 8.2, 8.3, 8.4 and 8.5. PHP 8.2 reaches end of life on 31 December 2026.

⁠Dropped versions

Images for PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 are no longer built. I used to keep building them for those who needed them, but on 21 October 2026 PHP announced two critical remote code execution vulnerabilities (CVE-2026-109618⁠ and CVE-2026-109619⁠) affecting all PHP installations serving web requests, PHP-FPM included. These versions are end of life and will not receive an official fix (announcement⁠), so I can't in good conscience keep publishing them.

If you are still running one of these versions, please upgrade to a supported version as soon as possible.

⁠PHP extensions

Besides the core extensions, the following are installed: apcu, bcmath, bz2, curl, dba, enchant, gd, igbinary, imagick, imap, intl, ldap, mbstring, memcached, mysql, pgsql, pspell, redis, tidy, xml, xmlrpc and zip. PEAR is installed as well.

⁠Apache modules

proxy_fcgi, setenvif, rewrite, headers, mime, expires and remoteip are enabled.

⁠PHP defaults
  • max_execution_time is 180 seconds
  • memory_limit is 1024M
  • date.timezone is Europe/Copenhagen
  • session.upload_progress.enabled is off, as a mitigation for CVE-2026-109619. It is set as an admin flag in the FPM pool, so applications cannot turn it back on
⁠Environment
⁠General
  • VIRTUAL_HOST: Sets the ServerName for the default vhost. Default is localhost.localdomain. Only needed if you do not provide your own vhost config
  • ADMIN_EMAIL: Sets ServerAdmin for the default vhost. Default is [email protected]
  • GENERATE_DEFAULT_VHOST: By default a basic vhost configuration is generated if /etc/apache2/sites-enabled is empty. Set to false to disable
  • MOD_REMOTEIP: Handles the configuration of mod_remoteip. DEFAULT (the default) uses X-Forwarded-For, CLOUDFLARE uses CF-Connecting-IP and trusts Cloudflare's published IP ranges, fetched at startup. 172.16.0.0/12 is always trusted. Any other value keeps the DEFAULT configuration

The following are inherited from the base image⁠:

  • PUID: Changes the uid of the app user, default 911
  • PGID: Changes the gid of the app group, default 911
  • SMTP_HOST: Change the SMTP relay server used by ssmtp (sendmail)
  • SMTP_USER: Username for the SMTP relay server
  • SMTP_PASS: Password for the SMTP relay server
  • SMTP_PORT: Outgoing SMTP port, default 587
  • SMTP_SECURE: Does the SMTP server requires a secure connection, default TRUE if SMTP_USER is set
  • SMTP_TLS: Use STARTTLS, default TRUE (if SMTP_TLS is FALSE and SMTP_SECURE is true, SMTP over SSL will be used)
  • SMTP_MASQ: Masquerade outbound emails using this domain
⁠PHP/FPM configuration
  • PHP_SESSION_SAVE_HANDLER: Sets session.save_handler. Default is files
  • PHP_SESSION_SAVE_PATH: Sets the path for saving sessions. Default is /var/lib/php/sessions. Use the full URI for Redis or Memcached: tcp://10.133.14.9:6379?auth=yourverycomplexpasswordhere
  • PHP_SESSION_GC_DIVISOR: Sets session.gc_divisor⁠. Default is 100
  • session.gc_probability is set automatically: 0 if the session handler is files, otherwise 1
  • PHP_UPLOAD_MAX_FILESIZE: Sets upload_max_filesize⁠. Default is 8M
  • PHP_POST_MAX_SIZE: Sets post_max_size⁠. Default is 9M
  • FPM_MAX_CHILDREN: Default is 5
  • FPM_START_SERVER: Default is 2
  • FPM_MIN_SPARE_SERVERS: Default is 1
  • FPM_MAX_SPARE_SERVERS: Default is 3
  • FPM_ERROR_LOG: Sets the error log of php-fpm. Default is /dev/fd/2 (stderr)
⁠Apache worker configuration

This image uses the event worker⁠

  • MPM_START_SERVERS: Default is 2
  • MPM_MIN_SPARE_THREADS: Default is 25
  • MPM_MAX_SPARE_THREADS: Default is 75
  • MPM_THREADLIMIT: Default is 64
  • MPM_THREADS_PER_CHILD: Default is 25
  • MPM_MAX_REQUEST_WORKERS: Default is 150
  • MPM_MAX_CONNECTIONS_PER_CHILD: Default is 0

Apache access and error logs go to stdout and stderr.

⁠Volumes

/var/www is defined as a volume and is the document root of the default vhost; port 80 is exposed.

Provide your own vhost configuration by adding --mount type=bind,source="$(pwd)"/sites-enabled,target=/etc/apache2/sites-enabled,readonly. Unlike -v, --mount does not create the directory on the host, so it must exist beforehand.

Tag summary

Content type

Image

Digest

sha256:e4757468e…

Size

179.4 MB

Last updated

6 days ago

docker pull ajoergensen/apache24-php-fpm:8.5