PHP 7.0-8.5 built from source with PGO, hardened, on Wolfi
100K+
PHP 7.0 to 8.5, compiled from source, PGO-trained on real applications, hardened, with the extensions you need already inside.
Stock PHP images are built with generic flags, carry a full Debian or Alpine userland, and leave every project to compile its own extensions. This image is built for production PHP: the interpreter is optimized on real PrestaShop, WordPress, Laravel, Symfony and Drupal traffic, 72 extensions are ready to use, and the image runs non-root on a minimal, signed Wolfi base.
php:8.5 image on CPU-bound code and 2 to 4%
more requests per second on Laravel (benchmarks).PHP_*
variables. The FPM pool and opcache size themselves from the container's memory limit.www-data), PIE, full RELRO, _FORTIFY_SOURCE=3, CET or
PAC/BTI, no setuid bits, read-only root filesystem support and optional Snuffleupagus rulesets
for WordPress, PrestaShop and Laravel.linux/amd64 and
linux/arm64, rebuilt weekly.GitHub · Full documentation · Lotus Web Agency
services:
php:
image: lotuswebagency/php:8.5-fpm
volumes:
- ./:/app
environment:
PHP_MEMORY_LIMIT: 512M
PHP_TIMEZONE: UTC
PHP_EXT_ENABLE: xdebug
Point your web server's FastCGI at php:9000. To build an application image:
FROM lotuswebagency/php:8.5-cli-builder AS build
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader
COPY . .
FROM lotuswebagency/php:8.5-fpm
COPY --from=build --chown=root:root /app /app
Tags follow {version}-{flavor}, for example 8.5-fpm or 8.4-cli. Versions: 7.0 to 8.5.
latest and 8.5 are 8.5-fpm. 8.5.13-fpm names the exact patch release.
| Flavor | Use |
|---|---|
fpm | PHP-FPM on port 9000, with a FastCGI healthcheck. |
cli | Scripts, cron jobs, queue workers. |
fpm-slim, cli-slim | The same PHP, about 45 MB smaller: no apk, curl or database clients. |
cli-builder | Build stages: Composer, Node.js 26, npm, git. |
ext-builder | Build stages that compile extra PHP extensions (phpize, gcc). |
PHP 8.4 and 8.5 also ship -v3 tags (8.5-fpm-v3) built for newer CPUs: x86-64-v3 or Neoverse
N2/V2 class arm64. On Apple silicon, Graviton2 or Graviton3, use the default tags. PHP 8.1 and older
are end-of-life upstream; they are still rebuilt but get no PHP security fixes
(support policy).
Tags move with patch releases and weekly rebuilds. Pin @sha256:... in production.
| Variable | Default | Sets |
|---|---|---|
PHP_MEMORY_LIMIT | fpm 256M, cli 512M | memory_limit |
PHP_MAX_EXECUTION_TIME | fpm 300, cli 0 | max_execution_time |
PHP_UPLOAD_MAX_FILESIZE, PHP_POST_MAX_SIZE | 128M | Upload limits |
PHP_TIMEZONE | unset | date.timezone |
PHP_DISPLAY_ERRORS | Off | Errors always go to stderr |
PHP_DISABLE_FUNCTIONS | fpm: exec, system, shell_exec and similar | Adds to the built-in list |
PHP_OPCACHE_VALIDATE_TIMESTAMPS | 1 | Set 0 when code is baked into the image |
PHP_OPCACHE_MEMORY | from the memory limit | opcache.memory_consumption |
PHP_OPCACHE_JIT | tracing | opcache.jit (8.1+) |
PHP_OPCACHE_PRELOAD | unset | opcache.preload |
PHP_EXT_ENABLE | unset | Shared extensions to load, e.g. ldap,uuid |
PHP_SNUFFLEUPAGUS | unset | default, wordpress, prestashop or laravel |
PHP_FPM_MAX_CHILDREN | from the memory limit | FPM pool size; PHP_FPM_WORKER_MEMORY (64 MB) tunes it |
PHP_FPM_PM, PHP_FPM_MAX_REQUESTS | dynamic, 1000 | FPM process manager |
Drop-in ini files go in /usr/local/etc/php/conf.d/ and must sort after 10-php.ini. The full list,
the autotuning rules and the Kubernetes setup are in the
configuration reference.
tini (do not add --init), working directory /app, user www-data (UID 33)./tmp.apk. There is no apt, pecl or docker-php-ext-install: compile extra
extensions in an ext-builder stage
(example).mysql, mysqldump and psql clients are in every non-slim image.services:
php:
image: lotuswebagency/php:8.5-fpm
read_only: true
tmpfs: ["/tmp:rw,noexec,nosuid,nodev,size=256m"]
cap_drop: [ALL]
security_opt: ["no-new-privileges:true"]
mem_limit: 1g
environment:
PHP_SNUFFLEUPAGUS: laravel
PHP_OPCACHE_VALIDATE_TIMESTAMPS: "0"
Details and the Kubernetes securityContext:
Hardened deployment.
Measured in December 2026 on an idle Xeon E-2286G (6 cores) against the official php:8.5.13
image, with identical effective settings on both sides (checked by diffing the ini values before
any timing).
CPU-bound workload (tests/bench/workload.php, held out of the PGO training; one pinned core,
15 interleaved runs, median time, lower is better):
| Mode | lotuswebagency/php:8.5-cli | php:8.5.13-cli | Difference |
|---|---|---|---|
| opcache off | 0.301 s | 0.345 s | 12.8% faster |
| opcache on, JIT off | 0.299 s | 0.347 s | 13.8% faster |
| JIT tracing | 0.290 s | 0.334 s | 13.1% faster |
Real applications behind nginx and PHP-FPM (6 static workers, the official image extended with the same extensions the apps need, same ini, wrk, 4 interleaved runs per side, JIT off and on):
| Application | Requests per second, ours vs official |
|---|---|
| Laravel | +2.2 to +4.3%, ahead in every run |
| WordPress | -1.4 to +3.4%, ahead on most pages |
| PrestaShop | 0 to +0.8%, level (database-bound) |
The interpreter itself is about 13% faster. In a full application the gain shrinks to what PHP execution is of the request time, and database or I/O-bound pages see little difference.
cosign verify lotuswebagency/php:8.5-fpm \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
--certificate-identity 'https://github.com/LotusWebAgency/php/.github/workflows/ci.yml@refs/heads/main'
dementev/php-fpm-with-ext: every tag has a same-named successor
(notes).| Image | What it does |
|---|---|
dementev/angie — source | Public-facing reverse proxy and TLS terminator — Angie, the nginx fork, with brotli, zstd and cache-purge |
dementev/nginx — source | Static sites and SPAs behind that proxy — brotli/zstd siblings, Prometheus stub_status |
lotuswebagency/php — this image | PHP 7.0 → 8.5 compiled from source on Wolfi, hardened and signed — successor to the deprecated dementev/php-fpm-with-ext |
lotuswebagency/nginx-nodejs — source | Rootless Node.js runtime behind Nginx, with sanitized logs and optional Loki delivery |
lotuswebagency/mysql-percona — source | Percona Server for MySQL 8.4 and 9.7 LTS with XtraBackup, compiled from source with PGO and hardened — the from-source successor to dementev/mysql-percona |
dementev/mysql-percona — source | Percona Server for MySQL 8.4 LTS, XtraBackup built in, no root inside |
dementev/adminer — source | Adminer 6 with every driver it supports, for reaching any of the above |
Built and maintained by Vasilii Dementev at Lotus Web Agency. All our open-source work: lotuswebagency.com/open-source.
Issues and pull requests: GitHub. Security reports: SECURITY.md. Packaging is MIT licensed; PHP and the bundled extensions keep their own licenses.
docker pull lotuswebagency/php:latest