Skip to content

Commit 1734b1f

Browse files
committed
downgrade to PHP 5.6
1 parent 71103ea commit 1734b1f

File tree

6 files changed

+45
-24
lines changed

6 files changed

+45
-24
lines changed

base/Dockerfile

+21-5
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,39 @@ RUN apt-get update && \
1212

1313
RUN apt-get update && \
1414
apt-get remove php7.0 && \
15-
apt-get install -y --no-install-recommends --no-install-suggests nginx php7.2 php7.2-fpm php7.2-cli php7.2-common ca-certificates gettext && \
15+
apt-get install -y --no-install-recommends \
16+
php5.6-bcmath \
17+
php5.6-cgi \
18+
php5.6-cli \
19+
php5.6-common \
20+
php5.6-fpm \
21+
php5.6-gd \
22+
php5.6-json \
23+
php5.6-mbstring \
24+
php5.6-mcrypt \
25+
php5.6-mysql \
26+
php5.6-opcache \
27+
php5.6-readline \
28+
php5.6-xcache \
29+
php5.6-xml \
30+
nginx \
31+
ca-certificates gettext && \
1632
rm -rf /var/lib/apt/lists/*
1733

1834
# forward request and error logs to docker log collector
1935
RUN ln -sf /dev/stderr /var/log/nginx/access.log \
2036
&& ln -sf /dev/stderr /var/log/nginx/error.log \
21-
&& ln -sf /dev/stderr /var/log/php7.2-fpm.log \
37+
&& ln -sf /dev/stderr /var/log/php5.6-fpm.log \
2238
&& ln -sf /dev/stderr /var/log/php-fpm.log
2339

2440
RUN rm -f /etc/nginx/sites-enabled/*
2541

2642
COPY nginx.conf.tpl /tmp/nginx.conf.tpl
2743
COPY php-fpm.conf.tpl /tmp/php-fpm.conf.tpl
28-
COPY defaults.ini /etc/php/7.2/cli/conf.d/defaults.ini
29-
COPY defaults.ini /etc/php/7.2/fpm/conf.d/defaults.ini
44+
COPY defaults.ini /etc/php/5.6/cli/conf.d/defaults.ini
45+
COPY defaults.ini /etc/php/5.6/fpm/conf.d/defaults.ini
3046

31-
RUN mkdir -p /run/php && touch /run/php/php7.2-fpm.sock && touch /run/php/php7.2-fpm.pid
47+
RUN mkdir -p /run/php && touch /run/php/php5.6-fpm.sock && touch /run/php/php5.6-fpm.pid
3248

3349
COPY entrypoint.sh /entrypoint.sh
3450
RUN chmod 755 /entrypoint.sh

base/entrypoint.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/usr/bin/env bash
22

33
export NGINX_WEB_ROOT=${NGINX_WEB_ROOT:-'/var/www/html'}
4-
export NGINX_PHP_FALLBACK=${NGINX_PHP_FALLBACK:-'/app.php'}
5-
export NGINX_PHP_LOCATION=${NGINX_PHP_LOCATION:-'^/app\.php(/|$)'}
4+
export NGINX_PHP_FALLBACK=${NGINX_PHP_FALLBACK:-'/index.php'}
5+
export NGINX_PHP_LOCATION=${NGINX_PHP_LOCATION:-'^\.php$'}
66
export NGINX_USER=${NGINX_USER:-'www-data'}
77
export NGINX_CONF=${NGINX_CONF:-'/etc/nginx/nginx.conf'}
88

99
export PHP_SOCK_FILE=${PHP_SOCK_FILE:-'/run/php.sock'}
1010
export PHP_USER=${PHP_USER:-'www-data'}
1111
export PHP_GROUP=${PHP_GROUP:-'www-data'}
1212
export PHP_MODE=${PHP_MODE:-'0660'}
13-
export PHP_FPM_CONF=${PHP_FPM_CONF:-'/etc/php/7.2/fpm/php-fpm.conf'}
13+
export PHP_FPM_CONF=${PHP_FPM_CONF:-'/etc/php/5.6/fpm/php-fpm.conf'}
1414

1515
envsubst '${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /tmp/nginx.conf.tpl > $NGINX_CONF
1616
envsubst '${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /tmp/php-fpm.conf.tpl > $PHP_FPM_CONF
@@ -22,7 +22,7 @@ nginx -c $NGINX_CONF -g 'daemon off;' 2>&1 &
2222
NGINX_PID=$!
2323

2424
echo 'Starting PHP-FPM';
25-
php-fpm7.2 -R -F -c $PHP_FPM_CONF 2>&1 &
25+
php-fpm5.6 -R -F -c $PHP_FPM_CONF 2>&1 &
2626
PHP_FPM_PID=$!
2727

2828
trap "TRAPPED_SIGNAL=true; kill -15 $NGINX_PID; kill -15 $PHP_FPM_PID;" SIGTERM SIGINT

base/nginx.conf.tpl

+13-11
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,22 @@ http {
3636
location / {
3737
try_files $uri $NGINX_PHP_FALLBACK$is_args$args;
3838
}
39-
location ~ $NGINX_PHP_LOCATION {
39+
40+
location ~ [^/]\.php(/|$) {
41+
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
42+
if (!-f $document_root$fastcgi_script_name) {
43+
return 404;
44+
}
45+
46+
fastcgi_param HTTP_PROXY "";
47+
4048
fastcgi_pass unix:$PHP_SOCK_FILE;
41-
fastcgi_split_path_info ^(.+\.php)(/.*)$;
42-
include fastcgi_params;
43-
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
44-
fastcgi_param DOCUMENT_ROOT $realpath_root;
49+
fastcgi_index index.php;
4550

46-
internal;
47-
}
51+
# include the fastcgi_param setting
52+
include fastcgi_params;
4853

49-
# return 404 for all other php files not matching the front controller
50-
# this prevents access to other php files you don't want to be accessible.
51-
location ~ \.php$ {
52-
return 404;
54+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
5355
}
5456
}
5557
}

base/php-fpm.conf.tpl

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[global]
2+
error_log = /var/log/php5.6-fpm.log
3+
14
[www]
25

36
pm = dynamic
@@ -15,3 +18,5 @@ listen = $PHP_SOCK_FILE
1518
listen.owner = $PHP_USER
1619
listen.group = $PHP_GROUP
1720
listen.mode = $PHP_MODE
21+
22+
php_admin_flag[log_errors] = on

build-images.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
set -x
44
set -e
55

6-
(cd base && docker build --rm --pull -t formapro/nginx-php-fpm:latest .)
7-
(cd php-all-exts && docker build --rm -t formapro/nginx-php-fpm:latest-all-exts .)
6+
(cd base && docker build --rm --pull -t beanieboi/nginx-php-fpm:5.6 .)

push-images.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
set -x
44
set -e
55

6-
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
7-
docker push formapro/nginx-php-fpm;
6+
docker push beanieboi/nginx-php-fpm;

0 commit comments

Comments
 (0)