Skip to content

fix: Apache logs, php.ini, HTTPS detection and CI health check - #58

Merged
guillaume-sainthillier merged 5 commits into
mainfrom
fix/image-runtime
Oct 12, 2026
Merged

guillaume-sainthillier merged 5 commits into
mainfrom
fix/image-runtime

Conversation

@guillaume-sainthillier

Copy link
Copy Markdown
Member

Fixes from an audit of the images, one commit per change. Each was checked on locally built 8.5, 8.5-symfony, 8.1-symfony and 8.5-ci images (before → after):

  • Apache logs on stdout/stderr: rm -rf /var/log/* deleted the base image's /var/log/apache2/*.log → /dev/stdout|stderr links, so Apache logged to files inside the container. Access lines in docker logs after 3 requests: 0 → 3. Already the case in the published images.
  • php.ini-production in the Apache images: no php.ini was loaded, so zend.assertions was 1 and responses carried X-Powered-By: PHP/x.y.z. Now php.ini-production + conf.d/app.ini (as the FrankenPHP images do), zend.assertions=-1, and expose_php = Off in app.ini (production ini leaves it on, so this also applies to FrankenPHP).
  • HTTPS behind a proxy: SetEnvIf X_FORWARDED_PROTO never matched the real X-Forwarded-Proto header; $_SERVER['HTTPS'] is now on with X-Forwarded-Proto: https. Like before the bug, the header is not limited to trusted proxies.
  • CI images: the health check curled a web server that doesn't exist, so the containers were always unhealthy. Removed.
  • Composer: the Apache images piped the getcomposer.org installer into php unchecked; now install-php-extensions @composer, like every other variant.

apache.conf / php.ini come from _shared/ and were synced with update.sh (legacy folders included, as usual), but only the 8.1–8.5 Dockerfiles changed: legacy images aren't rebuilt by CI.

Behaviour changes for derived images: php.ini-production sets error_reporting = E_ALL & ~E_DEPRECATED, variables_order = "GPCS" ($_ENV is no longer filled; getenv() and $_SERVER are unaffected) and zend.assertions = -1. The Apache/Symfony images get the same PHP settings as the FrankenPHP ones.

PHP 8.6 (#57) gets the same changes in its own PR.

The php:*-apache base images link /var/log/apache2/{access,error}.log to
/dev/stdout and /dev/stderr. Cleaning /var/log/* after apt-get deleted those
links, so apache2-foreground recreated the directory and Apache wrote its
logs to files inside the container: invisible to `docker logs` and growing
without bound. Only the apt lists are removed now.
The Apache images shipped no php.ini, so PHP ran on its built-in defaults,
which are development ones: zend.assertions=1 (assert() calls compiled and
executed in production) and the PHP version in an X-Powered-By header.
They now start from php.ini-production, as the FrankenPHP images already do,
with conf.d/app.ini on top. app.ini also sets expose_php = Off, which
php.ini-production leaves on.
SetEnvIf matched a header named X_FORWARDED_PROTO, which no proxy sends, so
$_SERVER['HTTPS'] was never set behind a TLS-terminating proxy.
The CI images run no web server, so the curl health check always failed and
every container using them was reported unhealthy.
The Apache images piped the getcomposer.org installer into php without
checking its signature. They now use install-php-extensions @composer like
8.5-symfony, the CI and FrankenPHP images.
guillaume-sainthillier added a commit that referenced this pull request Oct 12, 2026
Same changes as #58 (Apache logs on stdout/stderr, php.ini-production,
X-Forwarded-Proto, no health check in the CI image, Composer through
install-php-extensions) and #59 (OPcache timestamps and sizing), so the
8.6 folders match 8.5 apart from the base image.

conf/ is copied from _shared/ as it will be once both are merged; until
then, running update.sh on this branch alone would revert it.
@guillaume-sainthillier
guillaume-sainthillier merged commit c514574 into main Oct 12, 2026
25 checks passed
@guillaume-sainthillier
guillaume-sainthillier deleted the fix/image-runtime branch October 12, 2026 13:21
guillaume-sainthillier added a commit that referenced this pull request Oct 12, 2026
* feat: add PHP 8.6 release candidate images

Add the 8.6, 8.6-ci and 8.6-symfony variants, copied from 8.5 and built
from the upstream php:8.6-rc-apache / php:8.6-rc-alpine images (8.6.0RC3
today). They are published as silarhi/php-apache:8.6* and listed in the CI
matrix and the Makefile; latest stays on 8.5 until 8.6.0 is released.

FrankenPHP variants are not added yet: dunglas/frankenphp has no PHP 8.6
tag so far.

* fix: apply the image and OPcache fixes to the PHP 8.6 images

Same changes as #58 (Apache logs on stdout/stderr, php.ini-production,
X-Forwarded-Proto, no health check in the CI image, Composer through
install-php-extensions) and #59 (OPcache timestamps and sizing), so the
8.6 folders match 8.5 apart from the base image.

conf/ is copied from _shared/ as it will be once both are merged; until
then, running update.sh on this branch alone would revert it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant