Skip to content

Commit

Permalink
Release 7.1.0 - See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Oct 2, 2022
1 parent 8d0e90a commit 3f2ef3c
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 56 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 7.1.0 2022-10-01 <dave at tiredofit dot ca>

### Added
- Convert to using update_template functions when configuring

### Changed
- Fix an error where sample php file wasn't being created properly


## 7.0.11 2022-09-16 <dave at tiredofit dot ca>

### Changed
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ ENV PHP_BASE=${PHP_BASE:-"8.0"} \
PHP_ENABLE_XMLREADER=TRUE \
PHP_ENABLE_XMLWRITER=TRUE \
CONTAINER_ENABLE_MESSAGING=TRUE \
NGINX_ENABLE_CREATE_SAMPLE_HTML=FALSE
NGINX_ENABLE_CREATE_SAMPLE_HTML=FALSE \
IMAGE_NAME="tiredofit/nginx-php-fpm" \
IMAGE_REPO_URL="https://github.com/tiredofit/docker-nginx-php-fpm/"

### Dependency Installation
RUN export PHP_7_3_RUN_DEPS=" \
Expand Down
68 changes: 37 additions & 31 deletions install/assets/functions/20-php-fpm
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ EOF
fi

if var_false "${PHP_KITCHENSINK}" ; then
php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP}
unset PHP_ENABLE_CREATE_SAMPLE_PHP # legacy
unset PHP_ENABLE_DISPLAY_ERRORS # legacy
php_env_plugins_enabled=$(set -o posix; set | sort | grep PHP_ENABLE_ | grep -i TRUE |sed -e 's/PHP_ENABLE_//g' | sed -e 's/=TRUE//g' | awk -vRS="" -vOFS=', ' '$1=$1' | tr A-Z a-z)
for module in $(echo "${php_env_plugins_enabled}" | tr "," "\n" ) ; do
if [ -f "${php_prefix}"/mods-available/${module}.ini ]; then
Expand All @@ -140,6 +140,7 @@ EOF
done
print_notice "PHP-FPM Preparing to start with the following plugins enabled: ${php_actual_plugins_enabled}"
else
php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP}
print_warn "Enabling Kitchen Sink mode and allowing all plugins to be active"
silent php-ext enable all
fi
Expand All @@ -162,7 +163,7 @@ phpfpm_configure_logging() {
;;
esac

sed -i -e "s/<PHP_LOG_LEVEL>/${PHP_LOG_LEVEL}/g" /assets/php-fpm/fpm/php-fpm.conf
update_template /assets/php-fpm/fpm/php-fpm.conf PHP_LOG_LEVEL
}

phpfpm_configure_nginx() {
Expand Down Expand Up @@ -191,33 +192,39 @@ phpfpm_configure_nginx() {
phpfpm_configure_server() {
if [ "${PHP_BASE:0:1}" = "5" ] ; then echo "suhosin.executor.include.whitelist = phar" >> /etc/php"${PHP_BASE:0:1}"/php.ini ; fi
truefalse_onoff PHP_DISPLAY_ERRORS
sed -i "s|<DISPLAY_ERRORS>|${PHP_DISPLAY_ERRORS}|g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_LISTEN_PORT>#${PHP_FPM_LISTEN_PORT}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MAX_CHILDREN>#${PHP_FPM_MAX_CHILDREN}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MAX_EXECUTION_TIME>#${PHP_TIMEOUT}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MAX_REQUESTS>#${PHP_FPM_MAX_REQUESTS}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MAX_SPARE_SERVERS>#${PHP_FPM_MAX_SPARE_SERVERS}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MAX_START_SERVERS>#${PHP_FPM_START_SERVERS}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<MIN_SPARE_SERVERS>#${PHP_FPM_MIN_SPARE_SERVERS}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<OUTPUT_BUFFER_SIZE>#${PHP_FPM_OUTPUT_BUFFER_SIZE}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_HOST>#${PHP_FPM_HOST}#g" /etc/nginx/snippets/php-fpm.conf
sed -i -e "s#<PHP_LISTEN_PORT>#${PHP_FPM_LISTEN_PORT}#g" /etc/nginx/snippets/php-fpm.conf
sed -i -e "s#<PHP_LOG_LOCATION>#${PHP_LOG_LOCATION}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_LOG_ACCESS_FILE>#${PHP_LOG_ACCESS_FILE}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_LOG_ERROR_FILE>#${PHP_LOG_ERROR_FILE}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_LOG_LIMIT>#${PHP_LOG_LIMIT}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_MEMORY_LIMIT>#${PHP_MEMORY_LIMIT}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PHP_TIMEOUT>#${PHP_TIMEOUT}#g" /etc/nginx/snippets/php-fpm.conf
sed -i -e "s#<POST_MAX_SIZE>#${PHP_POST_MAX_SIZE}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<PROCESS_MANAGER>#${PHP_FPM_PROCESS_MANAGER}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#<UPLOAD_MAX_SIZE>#${PHP_UPLOAD_MAX_SIZE}#g" /assets/php-fpm/fpm/php-fpm.conf
sed -i -e "s#apc.shm_size.*#apc.shm_size=${PHP_APC_SHM_SIZE}#g" /assets/php-fpm//mods-available/apcu.ini
sed -i -e "s#opcache.memory_consumption.*#opcache.memory_consumption=$PHP_OPCACHE_MEM_SIZE#g" /assets/php-fpm/mods-available/opcache.ini
sed -i -e "s#memory_limit = .*#memory_limit = ${PHP_MEMORY_LIMIT}#g" /assets/php-fpm/cli/php.ini
sed -i -e "s#max_input_time = .*#max_input_time = ${PHP_TIMEOUT}#g" /assets/php-fpm/cli/php.ini
sed -i -e "s#default_socket_timeout = .*#default_socket_timeout = ${PHP_TIMEOUT}#g" /assets/php-fpm/cli/php.ini
sed -i -e "s#post_max_size = .*#post_max_size = ${PHP_UPLOAD_MAX_SIZE}#g" /assets/php-fpm/cli/php.ini
sed -i -e "s#upload_max_filesize = .*#upload_max_filesize = ${PHP_UPLOAD_MAX_SIZE}#g" /assets/php-fpm/cli/php.ini
update_template /assets/php-fpm/fpm/php-fpm.conf \
NGINX_USER \
NGINX_GROUP \
PHP_DISPLAY_ERRORS \
PHP_FPM_HOST \
PHP_FPM_LISTEN_PORT \
PHP_FPM_LISTEN_PORT \
PHP_FPM_MAX_CHILDREN \
PHP_FPM_MAX_REQUESTS \
PHP_FPM_MAX_SPARE_SERVERS \
PHP_FPM_MIN_SPARE_SERVERS \
PHP_FPM_OUTPUT_BUFFER_SIZE \
PHP_FPM_PROCESS_MANAGER \
PHP_FPM_START_SERVERS \
PHP_LOG_ACCESS_FILE \
PHP_LOG_ERROR_FILE \
PHP_LOG_LIMIT \
PHP_LOG_LOCATION \
PHP_MEMORY_LIMIT \
PHP_POST_MAX_SIZE \
PHP_TIMEOUT \
PHP_UPLOAD_MAX_SIZE

update_template /etc/nginx/snippets/php-fpm.conf PHP_TIMEOUT

sed -i "s#apc.shm_size.*#apc.shm_size=${PHP_APC_SHM_SIZE}#g" /assets/php-fpm//mods-available/apcu.ini
sed -i "s#opcache.memory_consumption.*#opcache.memory_consumption=$PHP_OPCACHE_MEM_SIZE#g" /assets/php-fpm/mods-available/opcache.ini
sed -i -e "s#memory_limit = .*#memory_limit = ${PHP_MEMORY_LIMIT}#g" \
-e "s#max_input_time = .*#max_input_time = ${PHP_TIMEOUT}#g" \
-e "s#default_socket_timeout = .*#default_socket_timeout = ${PHP_TIMEOUT}#g" \
-e "s#post_max_size = .*#post_max_size = ${PHP_UPLOAD_MAX_SIZE}#g" \
-e "s#upload_max_filesize = .*#upload_max_filesize = ${PHP_UPLOAD_MAX_SIZE}#g" \
/assets/php-fpm/cli/php.ini

if [ -n "${PHP_IDE_CONFIG}" ]; then
if [[ "${PHP_IDE_CONFIG}" = \"* ]] || [[ "${PHP_IDE_CONFIG}" = \'* ]] ; then
Expand All @@ -230,9 +237,8 @@ phpfpm_configure_server() {
sed -i -e "s#date.timezone = .*#date.timezone = $(cat /etc/timezone)#g" /assets/php-fpm/cli/php.ini
sed -i -e "s#date.timezone = .*#date.timezone = $(cat /etc/timezone)#g" /assets/php-fpm/fpm/php.ini
}

phpfpm_create_default_page() {
if var_true "${PHP_ENABLE_CREATE_SAMPLE_PHP}" ; then
if var_true "${php_enable_create_sample_php}" ; then
if [ ! -f "${NGINX_WEBROOT}"/index.php ] ; then
print_notice "Creating sample index.php"
mkdir -p "${NGINX_WEBROOT}"
Expand Down
40 changes: 20 additions & 20 deletions install/assets/php-fpm/fpm/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
error_log = <PHP_LOG_LOCATION>/<PHP_LOG_ERROR_FILE>
log_level = <PHP_LOG_LEVEL>
log_limit = <PHP_LOG_LIMIT>
error_log = {{PHP_LOG_LOCATION}}/{{PHP_LOG_ERROR_FILE}}
log_level = {{PHP_LOG_LEVEL}}
log_limit = {{PHP_LOG_LIMIT}}

[www]
listen = 0.0.0.0:<PHP_LISTEN_PORT>
listen.owner = nginx
listen.group = www-data
listen = 0.0.0.0:{{PHP_FPM_LISTEN_PORT}}
listen.owner = {{NGINX_USER}}
listen.group = {{NGINX_GROUP}}

access.log = <PHP_LOG_LOCATION>/<PHP_LOG_ACCESS_FILE>
access.log = {{PHP_LOG_LOCATION}}/{{PHP_LOG_ACCESS_FILE}}

pm = <PROCESS_MANAGER>
pm.max_children = <MAX_CHILDREN>
pm.start_servers = <MAX_START_SERVERS>
pm.min_spare_servers = <MIN_SPARE_SERVERS>
pm.max_spare_servers = <MAX_SPARE_SERVERS>
pm = {{PHP_FPM_PROCESS_MANAGER}}
pm.max_children = {{PHP_FPM_MAX_CHILDREN}}
pm.start_servers = {{PHP_FPM_START_SERVERS}}
pm.min_spare_servers = {{PHP_FPM_MIN_SPARE_SERVERS}}
pm.max_spare_servers = {{PHP_FPM_MAX_SPARE_SERVERS}}
pm.status_path = /php-fpm_status
ping.path = /ping

pm.process_idle_timeout = 10s
pm.max_requests = <MAX_REQUESTS>
php_admin_value[log_errors_max_len] = <PHP_LOG_LIMIT>
php_admin_value[max_execution_time] = <MAX_EXECUTION_TIME>
pm.max_requests = {{PHP_FPM_MAX_REQUESTS}}
php_admin_value[log_errors_max_len] = {{PHP_LOG_LIMIT}}
php_admin_value[max_execution_time] = {{PHP_TIMEOUT}}
php_admin_value[max_input_nesting_level] = 256
php_admin_value[max_input_vars] = 10000
php_admin_value[memory_limit] = <PHP_MEMORY_LIMIT>
php_admin_value[memory_limit] = {{PHP_MEMORY_LIMIT}}
php_admin_value[openssl.cafile] = /etc/ssl/certs/ca-certificates.crt
php_admin_value[openssl.capath] = /etc/ssl/certs
php_admin_value[output_buffering] = <OUTPUT_BUFFER_SIZE>
php_admin_value[post_max_size] = <POST_MAX_SIZE>
php_admin_value[upload_max_filesize] = <UPLOAD_MAX_SIZE>
php_flag[display_errors] = <DISPLAY_ERRORS>
php_admin_value[output_buffering] = {{PHP_FPM_OUTPUT_BUFFER_SIZE}}
php_admin_value[post_max_size] = {{PHP_POST_MAX_SIZE}}
php_admin_value[upload_max_filesize] = {{PHP_UPLOAD_MAX_SIZE}}
php_flag[display_errors] = {{PHP_DISPLAY_ERRORS}}
catch_workers_output = yes

env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Expand Down
4 changes: 2 additions & 2 deletions install/etc/cont-init.d/20-php-fpm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ if [ ! -f "/tmp/.container/container-restart" ] ; then
phpfpm_configure_extensions
phpfpm_configure_authentication
phpfpm_configure_logging
if [ "${PHP_FPM_CONTAINER_MODE,,}" != "php-fpm" ] ; then phpfpm_configure_nginx ; fi
if [ "${PHP_FPM_CONTAINER_MODE,,}" != "php-fpm" ] ; then phpfpm_create_default_page ; fi
if [[ "${PHP_FPM_CONTAINER_MODE,,}" == *"nginx"* ]] ; then phpfpm_configure_nginx ; fi
if [[ "${PHP_FPM_CONTAINER_MODE,,}" == *"php-fpm"* ]] ; then phpfpm_create_default_page ; fi
if var_true "${NGINX_ENABLE_APPLICATION_CONFIGURATION}"; then phpfpm_configure_site_default ; fi
phpfpm_post_init
fi
Expand Down
4 changes: 2 additions & 2 deletions install/etc/nginx/snippets/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fastcgi_pass php-fpm-upstream;
fastcgi_read_timeout <PHP_TIMEOUT>;
fastcgi_send_timeout <PHP_TIMEOUT>;
fastcgi_read_timeout {{PHP_TIMEOUT}};
fastcgi_send_timeout {{PHP_TIMEOUT}};
proxy_http_version 1.1;
proxy_set_header Connection "";

0 comments on commit 3f2ef3c

Please sign in to comment.