Endava / docker-php

This is a docker php (fpm+apache2+nginx unit) image, based on the official alpine/ubuntu packages for php.
https://hub.docker.com/r/endava/php
Apache License 2.0
18 stars 6 forks source link

Add display_errors to php.ini #58

Closed en-mbehrsing closed 9 months ago

en-mbehrsing commented 9 months ago

Can we add the following configs in php.ini and make it configurable via env vars?

Default values for both is enabled which needs to be changed for production systems

en-jschuetze commented 9 months ago
$ php -i | grep display_errors
display_errors => STDOUT => STDOUT
$ php -i | grep display_startup_errors
display_startup_errors => On => On

I will make it configurable.

diff --git a/Dockerfile b/Dockerfile
index fade71a..c9720ca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -181,6 +181,8 @@ ENV PHP_DATE_TIMEZONE="UTC" \
     PHP_XDEBUG_CLIENT_HOST='localhost' \
     PHP_XDEBUG_DISCOVER_CLIENT_HOST='false' \
     PHP_XDEBUG_IDEKEY='' \
+    PHP_DISPLAY_ERRORS='STDOUT' \
+    PHP_DISPLAY_STARTUP_ERRORS=1 \
     PHP_EXPOSE_PHP=1

 RUN mkdir -p /usr/src/app
diff --git a/files/php.ini b/files/php.ini
index bbee9c1..52af869 100644
--- a/files/php.ini
+++ b/files/php.ini
@@ -28,3 +28,5 @@ xdebug.idekey=${PHP_XDEBUG_IDEKEY}
 grpc.enable_fork_support=${PHP_GRPC_ENABLE_FORK_SUPPORT}
 grpc.poll_strategy=${PHP_GRPC_POLL_STRATEGY}
 expose_php=${PHP_EXPOSE_PHP}
+display_errors=${PHP_DISPLAY_ERRORS}
+display_startup_errors=${PHP_DISPLAY_STARTUP_ERRORS}
en-jschuetze commented 9 months ago

Added. Have fun!