php-fpm: refactor with deterministic config files & improved debug
All checks were successful
php-fpm-build / build (7.4) (push) Successful in 5m6s
All checks were successful
php-fpm-build / build (7.4) (push) Successful in 5m6s
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
set -eu
|
||||
|
||||
: ${CHOWN_ON_START:=}
|
||||
if [ "${CHOWN_ON_START}" = "1" ] || [ "${CHOWN_ON_START}" = "true" ]; then
|
||||
echo "[entrypoint] CHOWN_ON_START enabled — fixing ownership of /var/www/html"
|
||||
if [ -d /var/www/html ]; then
|
||||
chown -R 1000:1000 /var/www/html || true
|
||||
fi
|
||||
PHP_ENTRYPOINT="/usr/local/bin/docker-php-entrypoint"
|
||||
if [ ! -x "${PHP_ENTRYPOINT}" ]; then
|
||||
echo "[entrypoint] Missing ${PHP_ENTRYPOINT}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
case "${CHOWN_ON_START:-}" in
|
||||
1|true|TRUE|yes|on)
|
||||
echo "[entrypoint] CHOWN_ON_START enabled — fixing ownership of /var/www/html"
|
||||
if [ -d /var/www/html ]; then
|
||||
chown -R 1000:1000 /var/www/html || true
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
exec "${PHP_ENTRYPOINT}" "$@"
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
<?php
|
||||
// force-debug.php
|
||||
// This script is prepended to all PHP requests to force error reporting.
|
||||
// Optional debug bootstrap that can be toggled with FORCE_DEBUG_ERRORS=1.
|
||||
|
||||
$forceDebug = getenv('FORCE_DEBUG_ERRORS');
|
||||
if ($forceDebug === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$normalized = strtolower(trim($forceDebug));
|
||||
$enabled = in_array($normalized, ['1', 'true', 'yes', 'on'], true);
|
||||
|
||||
if (!$enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set error reporting to the highest level.
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// Ensure errors are displayed directly in the browser.
|
||||
// This overrides any ini_set('display_errors', 'Off') in the application.
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
// Also ensure errors are logged.
|
||||
ini_set('display_startup_errors', '1');
|
||||
ini_set('log_errors', '1');
|
||||
?>
|
||||
ini_set('error_log', '/proc/self/fd/2');
|
||||
|
||||
error_log('[force-debug] Verbose error reporting enabled via FORCE_DEBUG_ERRORS');
|
||||
|
||||
Reference in New Issue
Block a user