adamrollogi/php:{version} is the CLI image: PHP, Composer and the extensions a modern framework needs, with no web server. Use it for queue workers, schedulers, one-off commands and CI. The core and every extension are installed at the same pinned release, so the extensions always match the PHP they load into.
Tags
| Tag | Content |
|---|---|
8.2, 8.3, 8.4, 8.5 | Latest pinned release of that minor. |
8.6 | Current 8.6 release candidate (experimental). |
8.4.26 and other exact releases | Immutable. |
See Tags and versions.
Extensions
bcmath, ctype, curl, dom, exif, fileinfo, gd, iconv, intl, json, mbstring, mysqli, opcache, pcntl, pdo, pdo_mysql, phar, posix, redis, session, simplexml, soap, tokenizer, xml, xmlreader, xmlwriter, zip, imagick
Two of these are installed when Alpine packages them for the PHP version and skipped with a notice otherwise:
- opcache is compiled into PHP itself from 8.5, so there is no separate package. It is still present and still controlled by the
OPCACHE_*variables. - imagick is not yet packaged for PHP 8.6.
Composer 2 is installed from the official installer with signature verification.
Running commands
The entrypoint renders php.ini from your environment, then runs your command.
docker run --rm adamrollogi/php:8.4 php -v
docker run --rm -v $(pwd):/app -w /app adamrollogi/php:8.4 composer install --no-dev
docker run --rm -v $(pwd):/app -w /app -e PHP_MEMORY_LIMIT=1G adamrollogi/php:8.4 php bin/console cache:warmup
The default command starts Supervisor, which requires root. If you run the image as the default non-root user without a command, the entrypoint exits with a message explaining the options. In practice you always pass a command or run with --user root for cron.
Configuration
PHP settings are environment variables. The named ones cover the common cases and any other setting can be passed as php.<setting>.
docker run --rm \
-e PHP_MEMORY_LIMIT=512M \
-e PHP_DATE_TIMEZONE=Europe/London \
-e php.max_input_vars=5000 \
adamrollogi/php:8.4 php -i | grep -E "memory_limit|date.timezone|max_input_vars"
The full list is on PHP settings and in the environment variable reference.
How php.ini is loaded
The rendered php.ini is written to /run/php/php.ini and PHP finds it through the PHPRC environment variable. The stock /etc/php8x/ tree stays root-owned and unmodified, so a compromised script cannot rewrite PHP's configuration. See Users and permissions.
Layout
| Path | Purpose |
|---|---|
/usr/local/etc/php/php.ini.template | Template rendered at startup. |
/run/php/php.ini | Rendered php.ini (PHPRC=/run/php). |
/etc/php8x/conf.d/ | Stock extension ini files, root-owned. |
/usr/bin/php | Symlink to the versioned binary (php84). |
/usr/local/bin/composer | Composer 2. |
/usr/local/bin/php-entrypoint.sh | Entrypoint. |
Labels
org.opencontainers.image.version holds the exact PHP release, so docker inspect tells you what you are running without starting the container.