diff --git a/Dockerfile.lsphp b/Dockerfile.lsphp index c70de7b..588bcf2 100644 --- a/Dockerfile.lsphp +++ b/Dockerfile.lsphp @@ -54,6 +54,12 @@ RUN bash -c 'set -e; \ cp /etc/lsws-templates/lsphp-overrides.ini "$SCAN_DIR/99-prod-overrides.ini"; \ echo "wrote overrides to $SCAN_DIR"' +## php-lsapi gates .user.ini parsing behind this env var (see entrypoint-lsphp.sh +## for the full explanation). Set here so the value is visible in `docker inspect` +## and survives an entrypoint override; the entrypoint re-exports it with the same +## default so the runuser exec path can't drop it. +ENV LSPHP_ENABLE_USER_INI=on + EXPOSE 9000 ## TCP-connect + lsphp-alive check (LSAPI isn't FastCGI, so no cgi-fcgi ping). diff --git a/scripts/entrypoint-lsphp.sh b/scripts/entrypoint-lsphp.sh index c2f9edb..c75cd17 100644 --- a/scripts/entrypoint-lsphp.sh +++ b/scripts/entrypoint-lsphp.sh @@ -78,7 +78,26 @@ export LSAPI_EXTRA_CHILDREN="${LSAPI_EXTRA_CHILDREN:-5}" export LSAPI_AVOID_FORK="${LSAPI_AVOID_FORK:-0}" LSPHP_BIND="${LSPHP_BIND:-0.0.0.0:9000}" -echo "Container memory: ${CONTAINER_MEMORY_MB}MB | PHP_LSAPI_CHILDREN=${PHP_LSAPI_CHILDREN} | LSAPI_MAX_IDLE=${LSAPI_MAX_IDLE} | PHPVER=${PHPVER} | bind=${LSPHP_BIND}" +## ---- .user.ini support ---- +## php-lsapi compiles .user.ini support in but leaves it DISABLED by default: +## sapi/litespeed/lsapi_main.c has `static int parse_user_ini = 0;` and only +## sets it in PHP_MINIT_FUNCTION(litespeed) when the PROCESS ENV contains +## LSPHP_ENABLE_USER_INI=on. Without it, lsphp never enters the user-ini chain +## at all — and does so SILENTLY, because `user_ini.filename` / `user_ini.cache_ttl` +## still report their core defaults in phpinfo(). Every other WHP PHP tier +## (cac, cac-fpm, cac-litespeed) honors .user.ini, so leaving it off here made +## the shared-ols tier quietly inconsistent: customer memory_limit / +## max_input_vars overrides were ignored, and — the reason this was found — +## Wordfence's `auto_prepend_file` WAF never loaded on ANY shared-ols site. +## +## Exported here rather than relying solely on the Dockerfile ENV because the +## runuser fallback below resets the environment; an export survives all three +## exec paths. Still overridable per-container (set LSPHP_ENABLE_USER_INI=off in +## the site's env) as an escape hatch for a site whose legacy cPanel-generated +## .user.ini has not been remediated yet. +export LSPHP_ENABLE_USER_INI="${LSPHP_ENABLE_USER_INI:-on}" + +echo "Container memory: ${CONTAINER_MEMORY_MB}MB | PHP_LSAPI_CHILDREN=${PHP_LSAPI_CHILDREN} | LSAPI_MAX_IDLE=${LSAPI_MAX_IDLE} | PHPVER=${PHPVER} | bind=${LSPHP_BIND} | user_ini=${LSPHP_ENABLE_USER_INI}" ## ---- per-site ini drop-ins (identical mechanism to entrypoint-litespeed.sh) ---- ## error_log → the same customer-visible path cac:phpNN / cac-litespeed use, so