From abca2c7b06f7c8c618fc199f5d70b532ef7e25d9 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 2 Jun 2021 11:39:16 -0500 Subject: [PATCH] feat: use development php.ini settings This patch updates the base `php.ini` for each PHP version to provide the following develoment values (assuming that the version supports the setting): - `zend.exception_ignore_args = Off` - `zend.exception_string_param_max_len = 15` - `error_reporting = E_ALL` - `display_errors = On` - `display_startup_errors = On` - `mysqlnd.collect_memory_statistics = On` - `zend.assertions = 1` Fixes #36 Signed-off-by: Matthew Weier O'Phinney --- Dockerfile | 1 + scripts/php_ini_dev_settings.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 scripts/php_ini_dev_settings.sh diff --git a/Dockerfile b/Dockerfile index f452af1..96af029 100644 --- a/Dockerfile +++ b/Dockerfile @@ -145,6 +145,7 @@ RUN mkdir -p /usr/local/share/composer \ && ln -s /usr/local/share/composer/vendor/bin/cs2pr /usr/local/bin/cs2pr COPY scripts /scripts +RUN /scripts/php_ini_dev_settings.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN useradd -ms /bin/bash testuser diff --git a/scripts/php_ini_dev_settings.sh b/scripts/php_ini_dev_settings.sh new file mode 100755 index 0000000..518ebe9 --- /dev/null +++ b/scripts/php_ini_dev_settings.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +declare -a SUBSTITUTIONS + +SUBSTITUTIONS+=('s/zend.exception_ignore_args ?= ?(On|Off)/zend.exception_ignore_args = Off/') +SUBSTITUTIONS+=('s/zend.exception_string_param_max_len ?= ?[0-9]+/zend.exception_string_param_max_len = 15/') +SUBSTITUTIONS+=('s/error_reporting ?= ?[A-Z_~ &]+/error_reporting = E_ALL/') +SUBSTITUTIONS+=('s/display_errors ?= ?(On|Off)/display_errors = On/') +SUBSTITUTIONS+=('s/display_startup_errors ?= ?(On|Off)/display_startup_errors = On/') +SUBSTITUTIONS+=('s/mysqlnd.collect_memory_statistics ?= ?(On|Off)/mysqlnd.collect_memory_statistics = On/') +SUBSTITUTIONS+=('s/zend.assertions ?= ?(-1|1)/zend.assertions = 1/') +SUBSTITUTIONS+=('s/opcache.huge_code_pages ?= ?(0|1)/opcache.huge_code_pages = 0/') + +for PHP_VERSION in 5.6 7.0 7.1 7.2 7.3 7.4 8.0;do + INI_FILE="/etc/php/${PHP_VERSION}/cli/php.ini" + for SUBSTITUTION in "${SUBSTITUTIONS[@]}";do + sed --in-place -E -e "${SUBSTITUTION}" "${INI_FILE}" + done +done