HUB
Sign inSign up
php logo

lotuswebagency/php

By lotuswebagency

•Updated 1 day ago

PHP 7.0-8.5 built from source with PGO, hardened, on Wolfi

Image
Security
Languages & frameworks
Web servers
0

100K+

lotuswebagency/php repository overview

⁠lotuswebagency/php

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.

  • Faster PHP. Profile-guided optimization (PGO) trained on five real application stacks, plus ThinLTO on 8.5: about 13% faster than the official php:8.5 image on CPU-bound code and 2 to 4% more requests per second on Laravel (benchmarks⁠).
  • Batteries included. 53 extensions compiled in (redis, imagick, igbinary, apcu, memcached, zstd and the core set). 19 more load with one variable: xdebug, mongodb, swoole, amqp and others.
  • Configured by environment. Memory, opcache, JIT, uploads and the FPM pool are PHP_* variables. The FPM pool and opcache size themselves from the container's memory limit.
  • Secure by default. Non-root (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.
  • Verifiable. Every image passes a Trivy gate (no fixable HIGH or CRITICAL findings), is signed with Cosign and carries an SBOM and SLSA provenance.
  • Every version, both architectures. 11 PHP versions, 6 flavors, linux/amd64 and linux/arm64, rebuilt weekly.

GitHub⁠ · Full documentation⁠ · Lotus Web Agency⁠

⁠Quick start

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

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.

FlavorUse
fpmPHP-FPM on port 9000, with a FastCGI healthcheck.
cliScripts, cron jobs, queue workers.
fpm-slim, cli-slimThe same PHP, about 45 MB smaller: no apk, curl or database clients.
cli-builderBuild stages: Composer, Node.js 26, npm, git.
ext-builderBuild 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.

⁠Environment variables

VariableDefaultSets
PHP_MEMORY_LIMITfpm 256M, cli 512Mmemory_limit
PHP_MAX_EXECUTION_TIMEfpm 300, cli 0max_execution_time
PHP_UPLOAD_MAX_FILESIZE, PHP_POST_MAX_SIZE128MUpload limits
PHP_TIMEZONEunsetdate.timezone
PHP_DISPLAY_ERRORSOffErrors always go to stderr
PHP_DISABLE_FUNCTIONSfpm: exec, system, shell_exec and similarAdds to the built-in list
PHP_OPCACHE_VALIDATE_TIMESTAMPS1Set 0 when code is baked into the image
PHP_OPCACHE_MEMORYfrom the memory limitopcache.memory_consumption
PHP_OPCACHE_JITtracingopcache.jit (8.1+)
PHP_OPCACHE_PRELOADunsetopcache.preload
PHP_EXT_ENABLEunsetShared extensions to load, e.g. ldap,uuid
PHP_SNUFFLEUPAGUSunsetdefault, wordpress, prestashop or laravel
PHP_FPM_MAX_CHILDRENfrom the memory limitFPM pool size; PHP_FPM_WORKER_MEMORY (64 MB) tunes it
PHP_FPM_PM, PHP_FPM_MAX_REQUESTSdynamic, 1000FPM 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⁠.

⁠Image facts

  • Entrypoint tini (do not add --init), working directory /app, user www-data (UID 33).
  • Logs go to stderr. The only path the image writes is /tmp.
  • Package manager is 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.

⁠Hardened deployment

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⁠.

⁠Benchmarks

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):

Modelotuswebagency/php:8.5-cliphp:8.5.13-cliDifference
opcache off0.301 s0.345 s12.8% faster
opcache on, JIT off0.299 s0.347 s13.8% faster
JIT tracing0.290 s0.334 s13.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):

ApplicationRequests 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
PrestaShop0 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.

⁠Verify the image

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'

⁠Migrating

⁠More images from Lotus Web Agency

ImageWhat 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 imagePHP 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

⁠About

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.

Tag summary
Recent tags
Content type
Image
Digest
sha256:3f923d216…
Size
73.7 MB
Last updated
1 day ago
docker pull lotuswebagency/php:latest