1 Commits

Author SHA1 Message Date
Hans Rakers
a4a5333889 install Zend Opcache by default 2020-10-09 13:42:41 +02:00
2 changed files with 39 additions and 82 deletions

View File

@@ -20,10 +20,10 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# RUN set -eux; \
# mkdir ~/.gnupg; \
# echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
# gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0E604491
RUN set -eux; \
mkdir ~/.gnupg; \
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0E604491
# compile openssl, otherwise --with-openssl won't work
RUN set -eux; \
@@ -32,7 +32,7 @@ RUN set -eux; \
mkdir openssl; \
curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz; \
curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc" -o openssl.tar.gz.asc; \
# gpg --verify openssl.tar.gz.asc; \
gpg --verify openssl.tar.gz.asc; \
tar -xzf openssl.tar.gz -C openssl --strip-components=1; \
cd /tmp/openssl; \
./config no-ssl2 no-ssl3 zlib-dynamic -fPIC && make -j$(nproc) && make install_sw; \
@@ -64,10 +64,10 @@ RUN set -eux; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# RUN set -eux; \
# mkdir ~/.gnupg; \
# echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
# gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 5CC908FDB71E12C2
RUN set -eux; \
mkdir ~/.gnupg; \
echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 5CC908FDB71E12C2
RUN set -eux; \
CURL_VERSION="7.71.1"; \
@@ -75,7 +75,7 @@ RUN set -eux; \
mkdir curl; \
curl -sL "https://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz" -o curl.tar.gz; \
curl -sL "https://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz.asc" -o curl.tar.gz.asc; \
# gpg --verify curl.tar.gz.asc; \
gpg --verify curl.tar.gz.asc; \
tar -xzf curl.tar.gz -C curl --strip-components=1; \
cd /tmp/curl; \
./configure --prefix=/usr/local/curl --disable-shared --enable-static --disable-dependency-tracking \
@@ -129,12 +129,12 @@ RUN set -eux; \
ENV PHP_INI_DIR /usr/local/etc/php
# ENV GPG_KEYS 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7 A4A9406876FCBD3C456770C88C718D3B5072E1F5
# RUN set -xe \
# && mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
# && for key in $GPG_KEYS; do \
# gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
# done
ENV GPG_KEYS 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7 A4A9406876FCBD3C456770C88C718D3B5072E1F5
RUN set -xe \
&& mkdir ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
&& for key in $GPG_KEYS; do \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
done
ENV PHP_VERSION 5.3.29
@@ -156,22 +156,22 @@ COPY docker-php-source /usr/local/bin/
RUN set -eux; \
# Install MySQL 5.7 client library and headers (the system package is compiled against OpenSSL 1.1, which we can't use)
cd /usr/src; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb" -o libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb.asc" -o libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb.asc; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb" -o libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb.asc" -o libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb.asc; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-common_5.7.36-1ubuntu18.04_amd64.deb" -o mysql-common_5.7.36-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-common_5.7.36-1ubuntu18.04_amd64.deb.asc" -o mysql-common_5.7.36-1ubuntu18.04_amd64.deb.asc; \
# gpg --verify libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb.asc; \
# gpg --verify libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb.asc; \
# gpg --verify mysql-common_5.7.36-1ubuntu18.04_amd64.deb.asc; \
dpkg -i libmysqlclient-dev_5.7.36-1ubuntu18.04_amd64.deb libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb mysql-common_5.7.36-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb" -o libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb.asc" -o libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb.asc; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb" -o libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb.asc" -o libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb.asc; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/mysql-common_5.7.30-1ubuntu18.04_amd64.deb" -o mysql-common_5.7.30-1ubuntu18.04_amd64.deb; \
curl -SL "http://mirror.nl.leaseweb.net/mysql/Downloads/MySQL-5.7/mysql-common_5.7.30-1ubuntu18.04_amd64.deb.asc" -o mysql-common_5.7.30-1ubuntu18.04_amd64.deb.asc; \
gpg --verify libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb.asc; \
gpg --verify libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb.asc; \
gpg --verify mysql-common_5.7.30-1ubuntu18.04_amd64.deb.asc; \
dpkg -i libmysqlclient-dev_5.7.30-1ubuntu18.04_amd64.deb libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb mysql-common_5.7.30-1ubuntu18.04_amd64.deb; \
curl -SL "http://nl.php.net/get/php-$PHP_VERSION.tar.xz/from/this/mirror" -o php.tar.xz; \
curl -SL "http://nl.php.net/get/php-$PHP_VERSION.tar.xz.asc/from/this/mirror" -o php.tar.xz.asc; \
# This patch removes the GLOB_NOSORT flag from the glob() call in sapi/fpm/fpm/fpm_conf.c
# Without this, the read order of fpm config files is completely random. See https://bugs.php.net/bug.php?id=68391
curl -SL "https://github.com/php/php-src/commit/29d2c13809247dfd21b1f20d1d3771e10590694e.diff" -o fpm_conf_glob_sort.patch; \
# gpg --verify php.tar.xz.asc; \
gpg --verify php.tar.xz.asc; \
docker-php-source extract; \
cd /usr/src/php; \
export \
@@ -256,7 +256,7 @@ RUN set -eux; \
; \
# Install MySQL 5.7 client library and headers (the system package is compiled against OpenSSL 1.1)
cd /usr/src; \
dpkg -i libmysqlclient20_5.7.36-1ubuntu18.04_amd64.deb mysql-common_5.7.36-1ubuntu18.04_amd64.deb; \
dpkg -i libmysqlclient20_5.7.30-1ubuntu18.04_amd64.deb mysql-common_5.7.30-1ubuntu18.04_amd64.deb; \
rm /usr/src/*amd64.deb*; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
@@ -279,6 +279,11 @@ RUN set -eux; \
cd /; \
docker-php-source delete; \
pecl update-channels; \
# This solves the "not a valid package archive" errors
pear upgrade -Z Archive_Tar; \
# Install Zend Opcache
pecl install zendopcache; \
docker-php-ext-enable opcache; \
rm -rf /tmp/pear ~/.pearrc; \
php --version
@@ -321,58 +326,6 @@ RUN set -eux; \
echo 'listen = ${PHP_FPM_LISTEN}'; \
} | tee php-fpm.d/zz-docker.conf
RUN set -eux; \
{ \
echo '[Core]'; \
echo 'log_errors="On"'; \
echo 'error_log=/proc/self/fd/2'; \
echo 'date.timezone=Asia/Bangkok'; \
} | tee /usr/local/etc/php/conf.d/core.ini;
# install php-memcached
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
libmemcached-dev \
libz-dev \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
RUN set -eux; \
cd /tmp; \
curl -JLO https://github.com/php-memcached-dev/php-memcached/archive/refs/tags/2.2.0.tar.gz; \
tar xpf php-memcached-2.2.0.tar.gz; \
cd php-memcached-2.2.0; \
phpize; \
./configure; \
make install; \
cd /tmp; \
rm -rf php-memcached-2.2.0.tar.gz php-memcached-2.2.0
RUN set -eux; \
{ \
echo 'extension=memcached.so'; \
} | tee /usr/local/etc/php/conf.d/memcached.ini;
# install phpredis
RUN set -eux; \
PHPREDIS_VERSION="2.2.8"; \
cd /tmp; \
mkdir phpredis; \
curl -sL "https://pecl.php.net/get/redis-${PHPREDIS_VERSION}.tgz" -o phpredis.tar.gz; \
tar -xzf phpredis.tar.gz -C phpredis --strip-components=1; \
cd /tmp/phpredis; \
phpize; \
./configure; \
make install; \
rm -rf /tmp/*
RUN set -eux; \
{ \
echo 'extension=redis.so'; \
echo 'session.save_handler = redis'; \
echo 'session.save_path = "tcp://valkey:6379"'; \
} | tee /usr/local/etc/php/conf.d/redis.ini;
# Override stop signal to stop process gracefully
# https://github.com/php/php-src/blob/17baa87faddc2550def3ae7314236826bc1b1398/sapi/fpm/php-fpm.8.in#L163
STOPSIGNAL SIGQUIT

View File

@@ -17,10 +17,14 @@ See the [README](https://github.com/docker-library/docs/blob/master/php/README.m
## Differences with the original image
There are two deviations from the original image. This image contains a backported patch to fpm that changes the order in which configuration files are included from `/usr/local/etc/php-fpm.d`. By default in PHP 5.3 there was no sorting on the glob, causing files to be included in whatever order they appeared in the filesystem, which can differ from system to system. The patch removes the `GLOB_NOSORT` from the call to glob(), causing the files to be included in a alphabetic order. See [Dockerfile](Dockerfile) for details.
There are three deviations from the original image.
This image also allows you to override the default listen directive of fpm. By default, it will listen on `0.0.0.0:9000`, but you can override this using the environment variable `PHP_FPM_LISTEN`. For example:
* This image contains a backported patch to fpm that changes the order in which configuration files are included from `/usr/local/etc/php-fpm.d`. By default in PHP 5.3 there was no sorting on the glob, causing files to be included in whatever order they appeared in the filesystem, which can differ from system to system. The patch removes the `GLOB_NOSORT` from the call to glob(), causing the files to be included in a alphabetic order. See [Dockerfile](Dockerfile) for details.
* This image also allows you to override the default listen directive of fpm. By default, it will listen on `0.0.0.0:9000`, but you can override this using the environment variable `PHP_FPM_LISTEN`. For example:
```
docker run -it -e PHP_FPM_LISTEN="localhost:9000" hrak/php-5.3:latest
```
* Zend Opcache is included (extension load, but not enabled by default). You can enable and configure it through php.ini