# EOL PHP versions The official images stop receiving updates once a PHP version reaches end of life. For those versions we build PHP ourselves from the official images' Dockerfiles, with security patches applied to the sources, and use the result as the base image instead of `php:`. - `//Dockerfile`: the official Dockerfiles, one per tag suffix (`cli`, `apache`, `fpm`, `alpine`, `fpm-alpine`). - `patches/`: `docker-php-source-patch` and one `series.` per version, passed to the build as the `patches` named context. The patches are deb.sury.org's, from the Debian PHP team's [repository on Salsa](https://salsa.debian.org/php-team/php). Each Dockerfile downloads `debian/patches` from the Salsa commit in its `DEB_PATCHES` into a `deb-patches` stage. Each `series.` is an allow-list over that `series`: it names every patch in the same order, with the ones left out commented as `# : `. `docker-php-source-patch` fails the build if the two lists differ, so a new deb.sury.org revision can't add a patch nobody has reviewed. The build picks a directory up on its own: if `eol//` exists, the Makefile and `build-images.yml` build it as the base image. No workflow lists EOL versions. ## Adding a version Add it once deb.sury.org publishes patches for it: `make test` fails an EOL image whose `PHP_PATCHES` is empty. Until then, keep building on the official image. 1. **Find the source.** Take the last [docker-library/php](https://github.com/docker-library/php) commit that still has the `/` directory. For each flavor, pick the variant the plain official tag pointed to: `//{cli,apache,fpm}` and `/alpine/{cli,fpm}` for `alpine` and `fpm-alpine`. 2. **Copy the Dockerfiles** to `eol///Dockerfile`, with the header used by the other versions linking the exact source path at that commit. Copy only the Dockerfile, not the scripts next to it: the build adds them from the same commit. 3. **Mark every change** with a `# chialab:` comment: - set `ARG DOCKER_PHP_SCRIPTS` to the raw URL of the source path (`https://raw.githubusercontent.com/docker-library/php//`) just before the first `COPY`, and replace the `COPY docker-php-*` and `COPY apache2-foreground` lines with `ADD --chmod=755 $DOCKER_PHP_SCRIPTS/