├── 5.4 ├── Dockerfile ├── apache │ ├── Dockerfile │ ├── apache2-foreground │ ├── apache2.conf │ ├── docker-php-ext-configure │ └── docker-php-ext-install ├── docker-php-ext-configure ├── docker-php-ext-install └── fpm │ ├── Dockerfile │ ├── docker-php-ext-configure │ ├── docker-php-ext-install │ └── php-fpm.conf ├── 5.5 ├── Dockerfile ├── apache │ ├── Dockerfile │ ├── apache2-foreground │ ├── apache2.conf │ ├── docker-php-ext-configure │ └── docker-php-ext-install ├── docker-php-ext-configure ├── docker-php-ext-install └── fpm │ ├── Dockerfile │ ├── docker-php-ext-configure │ ├── docker-php-ext-install │ └── php-fpm.conf ├── 5.6 ├── Dockerfile ├── apache │ ├── Dockerfile │ ├── apache2-foreground │ ├── apache2.conf │ ├── docker-php-ext-configure │ └── docker-php-ext-install ├── docker-php-ext-configure ├── docker-php-ext-install └── fpm │ ├── Dockerfile │ ├── docker-php-ext-configure │ ├── docker-php-ext-install │ └── php-fpm.conf ├── LICENSE ├── README.md ├── apache-Dockerfile-block-1 ├── apache-Dockerfile-block-2 ├── docker-php-ext-configure ├── docker-php-ext-install ├── fpm-Dockerfile-block-1 ├── fpm-Dockerfile-block-2 ├── generate-stackbrew-library.sh └── update.sh /5.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | #### 14 | 15 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D 16 | 17 | ENV PHP_VERSION 5.4.38 18 | 19 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 20 | RUN buildDeps=" \ 21 | $PHP_EXTRA_BUILD_DEPS \ 22 | bzip2 \ 23 | file \ 24 | libcurl4-openssl-dev \ 25 | libreadline6-dev \ 26 | libssl-dev \ 27 | libxml2-dev \ 28 | "; \ 29 | set -x \ 30 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 31 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 33 | && gpg --verify php.tar.bz2.asc \ 34 | && mkdir -p /usr/src/php \ 35 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 36 | && rm php.tar.bz2* \ 37 | && cd /usr/src/php \ 38 | && ./configure \ 39 | --with-config-file-path="$PHP_INI_DIR" \ 40 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 41 | $PHP_EXTRA_CONFIGURE_ARGS \ 42 | --disable-cgi \ 43 | --enable-mysqlnd \ 44 | --with-curl \ 45 | --with-openssl \ 46 | --with-readline \ 47 | --with-zlib \ 48 | && make -j"$(nproc)" \ 49 | && make install \ 50 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 51 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 52 | && make clean 53 | 54 | COPY docker-php-ext-* /usr/local/bin/ 55 | 56 | #### 57 | CMD ["php", "-a"] 58 | #### 59 | -------------------------------------------------------------------------------- /5.4/apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* 14 | 15 | RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html 16 | 17 | # Apache + PHP requires preforking Apache for best results 18 | RUN a2dismod mpm_event && a2enmod mpm_prefork 19 | 20 | RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist 21 | COPY apache2.conf /etc/apache2/apache2.conf 22 | # it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation 23 | 24 | ENV PHP_EXTRA_BUILD_DEPS apache2-dev 25 | ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 26 | #### 27 | 28 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D 29 | 30 | ENV PHP_VERSION 5.4.38 31 | 32 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 33 | RUN buildDeps=" \ 34 | $PHP_EXTRA_BUILD_DEPS \ 35 | bzip2 \ 36 | file \ 37 | libcurl4-openssl-dev \ 38 | libreadline6-dev \ 39 | libssl-dev \ 40 | libxml2-dev \ 41 | "; \ 42 | set -x \ 43 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 44 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 45 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 46 | && gpg --verify php.tar.bz2.asc \ 47 | && mkdir -p /usr/src/php \ 48 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 49 | && rm php.tar.bz2* \ 50 | && cd /usr/src/php \ 51 | && ./configure \ 52 | --with-config-file-path="$PHP_INI_DIR" \ 53 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 54 | $PHP_EXTRA_CONFIGURE_ARGS \ 55 | --disable-cgi \ 56 | --enable-mysqlnd \ 57 | --with-curl \ 58 | --with-openssl \ 59 | --with-readline \ 60 | --with-zlib \ 61 | && make -j"$(nproc)" \ 62 | && make install \ 63 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 64 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 65 | && make clean 66 | 67 | COPY docker-php-ext-* /usr/local/bin/ 68 | 69 | #### 70 | COPY apache2-foreground /usr/local/bin/ 71 | WORKDIR /var/www/html 72 | 73 | EXPOSE 80 74 | CMD ["apache2-foreground"] 75 | #### 76 | -------------------------------------------------------------------------------- /5.4/apache/apache2-foreground: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Apache gets grumpy about PID files pre-existing 5 | rm -f /var/run/apache2/apache2.pid 6 | 7 | exec apache2 -DFOREGROUND 8 | -------------------------------------------------------------------------------- /5.4/apache/apache2.conf: -------------------------------------------------------------------------------- 1 | # see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf 2 | 3 | Mutex file:/var/lock/apache2 default 4 | PidFile /var/run/apache2/apache2.pid 5 | Timeout 300 6 | KeepAlive On 7 | MaxKeepAliveRequests 100 8 | KeepAliveTimeout 5 9 | User www-data 10 | Group www-data 11 | HostnameLookups Off 12 | ErrorLog /proc/self/fd/2 13 | LogLevel warn 14 | 15 | IncludeOptional mods-enabled/*.load 16 | IncludeOptional mods-enabled/*.conf 17 | 18 | # ports.conf 19 | Listen 80 20 | 21 | Listen 443 22 | 23 | 24 | Listen 443 25 | 26 | 27 | 28 | Options FollowSymLinks 29 | AllowOverride None 30 | Require all denied 31 | 32 | 33 | 34 | AllowOverride All 35 | Require all granted 36 | 37 | 38 | DocumentRoot /var/www/html 39 | 40 | AccessFileName .htaccess 41 | 42 | Require all denied 43 | 44 | 45 | LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined 46 | LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 47 | LogFormat "%h %l %u %t \"%r\" %>s %O" common 48 | LogFormat "%{Referer}i -> %U" referer 49 | LogFormat "%{User-agent}i" agent 50 | 51 | CustomLog /proc/self/fd/1 combined 52 | 53 | 54 | SetHandler application/x-httpd-php 55 | 56 | 57 | # Multiple DirectoryIndex directives within the same context will add 58 | # to the list of resources to look for rather than replace 59 | # https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex 60 | DirectoryIndex disabled 61 | DirectoryIndex index.php index.html 62 | -------------------------------------------------------------------------------- /5.4/apache/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.4/apache/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.4/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.4/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.4/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 14 | #### 15 | 16 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D 17 | 18 | ENV PHP_VERSION 5.4.38 19 | 20 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 21 | RUN buildDeps=" \ 22 | $PHP_EXTRA_BUILD_DEPS \ 23 | bzip2 \ 24 | file \ 25 | libcurl4-openssl-dev \ 26 | libreadline6-dev \ 27 | libssl-dev \ 28 | libxml2-dev \ 29 | "; \ 30 | set -x \ 31 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 33 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 34 | && gpg --verify php.tar.bz2.asc \ 35 | && mkdir -p /usr/src/php \ 36 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 37 | && rm php.tar.bz2* \ 38 | && cd /usr/src/php \ 39 | && ./configure \ 40 | --with-config-file-path="$PHP_INI_DIR" \ 41 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 42 | $PHP_EXTRA_CONFIGURE_ARGS \ 43 | --disable-cgi \ 44 | --enable-mysqlnd \ 45 | --with-curl \ 46 | --with-openssl \ 47 | --with-readline \ 48 | --with-zlib \ 49 | && make -j"$(nproc)" \ 50 | && make install \ 51 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 52 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 53 | && make clean 54 | 55 | COPY docker-php-ext-* /usr/local/bin/ 56 | 57 | #### 58 | WORKDIR /var/www/html 59 | COPY php-fpm.conf /usr/local/etc/ 60 | 61 | EXPOSE 9000 62 | CMD ["php-fpm"] 63 | #### 64 | -------------------------------------------------------------------------------- /5.4/fpm/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.4/fpm/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.4/fpm/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; This file was initially adapated from the output of: (on PHP 5.6) 2 | ; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default 3 | 4 | [global] 5 | 6 | error_log = /proc/self/fd/2 7 | daemonize = no 8 | 9 | [www] 10 | 11 | ; if we send this to /proc/self/fd/1, it never appears 12 | access.log = /proc/self/fd/2 13 | 14 | user = www-data 15 | group = www-data 16 | 17 | listen = 9000 18 | 19 | pm = dynamic 20 | pm.max_children = 5 21 | pm.start_servers = 2 22 | pm.min_spare_servers = 1 23 | pm.max_spare_servers = 3 24 | -------------------------------------------------------------------------------- /5.5/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | #### 14 | 15 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D 16 | 17 | ENV PHP_VERSION 5.5.22 18 | 19 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 20 | RUN buildDeps=" \ 21 | $PHP_EXTRA_BUILD_DEPS \ 22 | bzip2 \ 23 | file \ 24 | libcurl4-openssl-dev \ 25 | libreadline6-dev \ 26 | libssl-dev \ 27 | libxml2-dev \ 28 | "; \ 29 | set -x \ 30 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 31 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 33 | && gpg --verify php.tar.bz2.asc \ 34 | && mkdir -p /usr/src/php \ 35 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 36 | && rm php.tar.bz2* \ 37 | && cd /usr/src/php \ 38 | && ./configure \ 39 | --with-config-file-path="$PHP_INI_DIR" \ 40 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 41 | $PHP_EXTRA_CONFIGURE_ARGS \ 42 | --disable-cgi \ 43 | --enable-mysqlnd \ 44 | --with-curl \ 45 | --with-openssl \ 46 | --with-readline \ 47 | --with-zlib \ 48 | && make -j"$(nproc)" \ 49 | && make install \ 50 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 51 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 52 | && make clean 53 | 54 | COPY docker-php-ext-* /usr/local/bin/ 55 | 56 | #### 57 | CMD ["php", "-a"] 58 | #### 59 | -------------------------------------------------------------------------------- /5.5/apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* 14 | 15 | RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html 16 | 17 | # Apache + PHP requires preforking Apache for best results 18 | RUN a2dismod mpm_event && a2enmod mpm_prefork 19 | 20 | RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist 21 | COPY apache2.conf /etc/apache2/apache2.conf 22 | # it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation 23 | 24 | ENV PHP_EXTRA_BUILD_DEPS apache2-dev 25 | ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 26 | #### 27 | 28 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D 29 | 30 | ENV PHP_VERSION 5.5.22 31 | 32 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 33 | RUN buildDeps=" \ 34 | $PHP_EXTRA_BUILD_DEPS \ 35 | bzip2 \ 36 | file \ 37 | libcurl4-openssl-dev \ 38 | libreadline6-dev \ 39 | libssl-dev \ 40 | libxml2-dev \ 41 | "; \ 42 | set -x \ 43 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 44 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 45 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 46 | && gpg --verify php.tar.bz2.asc \ 47 | && mkdir -p /usr/src/php \ 48 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 49 | && rm php.tar.bz2* \ 50 | && cd /usr/src/php \ 51 | && ./configure \ 52 | --with-config-file-path="$PHP_INI_DIR" \ 53 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 54 | $PHP_EXTRA_CONFIGURE_ARGS \ 55 | --disable-cgi \ 56 | --enable-mysqlnd \ 57 | --with-curl \ 58 | --with-openssl \ 59 | --with-readline \ 60 | --with-zlib \ 61 | && make -j"$(nproc)" \ 62 | && make install \ 63 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 64 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 65 | && make clean 66 | 67 | COPY docker-php-ext-* /usr/local/bin/ 68 | 69 | #### 70 | COPY apache2-foreground /usr/local/bin/ 71 | WORKDIR /var/www/html 72 | 73 | EXPOSE 80 74 | CMD ["apache2-foreground"] 75 | #### 76 | -------------------------------------------------------------------------------- /5.5/apache/apache2-foreground: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Apache gets grumpy about PID files pre-existing 5 | rm -f /var/run/apache2/apache2.pid 6 | 7 | exec apache2 -DFOREGROUND 8 | -------------------------------------------------------------------------------- /5.5/apache/apache2.conf: -------------------------------------------------------------------------------- 1 | # see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf 2 | 3 | Mutex file:/var/lock/apache2 default 4 | PidFile /var/run/apache2/apache2.pid 5 | Timeout 300 6 | KeepAlive On 7 | MaxKeepAliveRequests 100 8 | KeepAliveTimeout 5 9 | User www-data 10 | Group www-data 11 | HostnameLookups Off 12 | ErrorLog /proc/self/fd/2 13 | LogLevel warn 14 | 15 | IncludeOptional mods-enabled/*.load 16 | IncludeOptional mods-enabled/*.conf 17 | 18 | # ports.conf 19 | Listen 80 20 | 21 | Listen 443 22 | 23 | 24 | Listen 443 25 | 26 | 27 | 28 | Options FollowSymLinks 29 | AllowOverride None 30 | Require all denied 31 | 32 | 33 | 34 | AllowOverride All 35 | Require all granted 36 | 37 | 38 | DocumentRoot /var/www/html 39 | 40 | AccessFileName .htaccess 41 | 42 | Require all denied 43 | 44 | 45 | LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined 46 | LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 47 | LogFormat "%h %l %u %t \"%r\" %>s %O" common 48 | LogFormat "%{Referer}i -> %U" referer 49 | LogFormat "%{User-agent}i" agent 50 | 51 | CustomLog /proc/self/fd/1 combined 52 | 53 | 54 | SetHandler application/x-httpd-php 55 | 56 | 57 | # Multiple DirectoryIndex directives within the same context will add 58 | # to the list of resources to look for rather than replace 59 | # https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex 60 | DirectoryIndex disabled 61 | DirectoryIndex index.php index.html 62 | -------------------------------------------------------------------------------- /5.5/apache/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.5/apache/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.5/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.5/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.5/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 14 | #### 15 | 16 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D 17 | 18 | ENV PHP_VERSION 5.5.22 19 | 20 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 21 | RUN buildDeps=" \ 22 | $PHP_EXTRA_BUILD_DEPS \ 23 | bzip2 \ 24 | file \ 25 | libcurl4-openssl-dev \ 26 | libreadline6-dev \ 27 | libssl-dev \ 28 | libxml2-dev \ 29 | "; \ 30 | set -x \ 31 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 33 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 34 | && gpg --verify php.tar.bz2.asc \ 35 | && mkdir -p /usr/src/php \ 36 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 37 | && rm php.tar.bz2* \ 38 | && cd /usr/src/php \ 39 | && ./configure \ 40 | --with-config-file-path="$PHP_INI_DIR" \ 41 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 42 | $PHP_EXTRA_CONFIGURE_ARGS \ 43 | --disable-cgi \ 44 | --enable-mysqlnd \ 45 | --with-curl \ 46 | --with-openssl \ 47 | --with-readline \ 48 | --with-zlib \ 49 | && make -j"$(nproc)" \ 50 | && make install \ 51 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 52 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 53 | && make clean 54 | 55 | COPY docker-php-ext-* /usr/local/bin/ 56 | 57 | #### 58 | WORKDIR /var/www/html 59 | COPY php-fpm.conf /usr/local/etc/ 60 | 61 | EXPOSE 9000 62 | CMD ["php-fpm"] 63 | #### 64 | -------------------------------------------------------------------------------- /5.5/fpm/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.5/fpm/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.5/fpm/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; This file was initially adapated from the output of: (on PHP 5.6) 2 | ; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default 3 | 4 | [global] 5 | 6 | error_log = /proc/self/fd/2 7 | daemonize = no 8 | 9 | [www] 10 | 11 | ; if we send this to /proc/self/fd/1, it never appears 12 | access.log = /proc/self/fd/2 13 | 14 | user = www-data 15 | group = www-data 16 | 17 | listen = [::]:9000 18 | 19 | pm = dynamic 20 | pm.max_children = 5 21 | pm.start_servers = 2 22 | pm.min_spare_servers = 1 23 | pm.max_spare_servers = 3 24 | -------------------------------------------------------------------------------- /5.6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | #### 14 | 15 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1 16 | 17 | ENV PHP_VERSION 5.6.6 18 | 19 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 20 | RUN buildDeps=" \ 21 | $PHP_EXTRA_BUILD_DEPS \ 22 | bzip2 \ 23 | file \ 24 | libcurl4-openssl-dev \ 25 | libreadline6-dev \ 26 | libssl-dev \ 27 | libxml2-dev \ 28 | "; \ 29 | set -x \ 30 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 31 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 33 | && gpg --verify php.tar.bz2.asc \ 34 | && mkdir -p /usr/src/php \ 35 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 36 | && rm php.tar.bz2* \ 37 | && cd /usr/src/php \ 38 | && ./configure \ 39 | --with-config-file-path="$PHP_INI_DIR" \ 40 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 41 | $PHP_EXTRA_CONFIGURE_ARGS \ 42 | --disable-cgi \ 43 | --enable-mysqlnd \ 44 | --with-curl \ 45 | --with-openssl \ 46 | --with-readline \ 47 | --with-zlib \ 48 | && make -j"$(nproc)" \ 49 | && make install \ 50 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 51 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 52 | && make clean 53 | 54 | COPY docker-php-ext-* /usr/local/bin/ 55 | 56 | #### 57 | CMD ["php", "-a"] 58 | #### 59 | -------------------------------------------------------------------------------- /5.6/apache/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* 14 | 15 | RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html 16 | 17 | # Apache + PHP requires preforking Apache for best results 18 | RUN a2dismod mpm_event && a2enmod mpm_prefork 19 | 20 | RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist 21 | COPY apache2.conf /etc/apache2/apache2.conf 22 | # it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation 23 | 24 | ENV PHP_EXTRA_BUILD_DEPS apache2-dev 25 | ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 26 | #### 27 | 28 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1 29 | 30 | ENV PHP_VERSION 5.6.6 31 | 32 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 33 | RUN buildDeps=" \ 34 | $PHP_EXTRA_BUILD_DEPS \ 35 | bzip2 \ 36 | file \ 37 | libcurl4-openssl-dev \ 38 | libreadline6-dev \ 39 | libssl-dev \ 40 | libxml2-dev \ 41 | "; \ 42 | set -x \ 43 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 44 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 45 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 46 | && gpg --verify php.tar.bz2.asc \ 47 | && mkdir -p /usr/src/php \ 48 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 49 | && rm php.tar.bz2* \ 50 | && cd /usr/src/php \ 51 | && ./configure \ 52 | --with-config-file-path="$PHP_INI_DIR" \ 53 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 54 | $PHP_EXTRA_CONFIGURE_ARGS \ 55 | --disable-cgi \ 56 | --enable-mysqlnd \ 57 | --with-curl \ 58 | --with-openssl \ 59 | --with-readline \ 60 | --with-zlib \ 61 | && make -j"$(nproc)" \ 62 | && make install \ 63 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 64 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 65 | && make clean 66 | 67 | COPY docker-php-ext-* /usr/local/bin/ 68 | 69 | #### 70 | COPY apache2-foreground /usr/local/bin/ 71 | WORKDIR /var/www/html 72 | 73 | EXPOSE 80 74 | CMD ["apache2-foreground"] 75 | #### 76 | -------------------------------------------------------------------------------- /5.6/apache/apache2-foreground: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Apache gets grumpy about PID files pre-existing 5 | rm -f /var/run/apache2/apache2.pid 6 | 7 | exec apache2 -DFOREGROUND 8 | -------------------------------------------------------------------------------- /5.6/apache/apache2.conf: -------------------------------------------------------------------------------- 1 | # see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf 2 | 3 | Mutex file:/var/lock/apache2 default 4 | PidFile /var/run/apache2/apache2.pid 5 | Timeout 300 6 | KeepAlive On 7 | MaxKeepAliveRequests 100 8 | KeepAliveTimeout 5 9 | User www-data 10 | Group www-data 11 | HostnameLookups Off 12 | ErrorLog /proc/self/fd/2 13 | LogLevel warn 14 | 15 | IncludeOptional mods-enabled/*.load 16 | IncludeOptional mods-enabled/*.conf 17 | 18 | # ports.conf 19 | Listen 80 20 | 21 | Listen 443 22 | 23 | 24 | Listen 443 25 | 26 | 27 | 28 | Options FollowSymLinks 29 | AllowOverride None 30 | Require all denied 31 | 32 | 33 | 34 | AllowOverride All 35 | Require all granted 36 | 37 | 38 | DocumentRoot /var/www/html 39 | 40 | AccessFileName .htaccess 41 | 42 | Require all denied 43 | 44 | 45 | LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined 46 | LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 47 | LogFormat "%h %l %u %t \"%r\" %>s %O" common 48 | LogFormat "%{Referer}i -> %U" referer 49 | LogFormat "%{User-agent}i" agent 50 | 51 | CustomLog /proc/self/fd/1 combined 52 | 53 | 54 | SetHandler application/x-httpd-php 55 | 56 | 57 | # Multiple DirectoryIndex directives within the same context will add 58 | # to the list of resources to look for rather than replace 59 | # https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex 60 | DirectoryIndex disabled 61 | DirectoryIndex index.php index.html 62 | -------------------------------------------------------------------------------- /5.6/apache/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.6/apache/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.6/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.6/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.6/fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | # persistent / runtime deps 4 | RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* 5 | 6 | # phpize deps 7 | RUN apt-get update && apt-get install -y autoconf gcc libc-dev make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* 8 | 9 | ENV PHP_INI_DIR /usr/local/etc/php 10 | RUN mkdir -p $PHP_INI_DIR/conf.d 11 | 12 | #### 13 | ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 14 | #### 15 | 16 | RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1 17 | 18 | ENV PHP_VERSION 5.6.6 19 | 20 | # --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) 21 | RUN buildDeps=" \ 22 | $PHP_EXTRA_BUILD_DEPS \ 23 | bzip2 \ 24 | file \ 25 | libcurl4-openssl-dev \ 26 | libreadline6-dev \ 27 | libssl-dev \ 28 | libxml2-dev \ 29 | "; \ 30 | set -x \ 31 | && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ 32 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \ 33 | && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \ 34 | && gpg --verify php.tar.bz2.asc \ 35 | && mkdir -p /usr/src/php \ 36 | && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ 37 | && rm php.tar.bz2* \ 38 | && cd /usr/src/php \ 39 | && ./configure \ 40 | --with-config-file-path="$PHP_INI_DIR" \ 41 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 42 | $PHP_EXTRA_CONFIGURE_ARGS \ 43 | --disable-cgi \ 44 | --enable-mysqlnd \ 45 | --with-curl \ 46 | --with-openssl \ 47 | --with-readline \ 48 | --with-zlib \ 49 | && make -j"$(nproc)" \ 50 | && make install \ 51 | && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ 52 | && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ 53 | && make clean 54 | 55 | COPY docker-php-ext-* /usr/local/bin/ 56 | 57 | #### 58 | WORKDIR /var/www/html 59 | COPY php-fpm.conf /usr/local/etc/ 60 | 61 | EXPOSE 9000 62 | CMD ["php-fpm"] 63 | #### 64 | -------------------------------------------------------------------------------- /5.6/fpm/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /5.6/fpm/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /5.6/fpm/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ; This file was initially adapated from the output of: (on PHP 5.6) 2 | ; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default 3 | 4 | [global] 5 | 6 | error_log = /proc/self/fd/2 7 | daemonize = no 8 | 9 | [www] 10 | 11 | ; if we send this to /proc/self/fd/1, it never appears 12 | access.log = /proc/self/fd/2 13 | 14 | user = www-data 15 | group = www-data 16 | 17 | listen = [::]:9000 18 | 19 | pm = dynamic 20 | pm.max_children = 5 21 | pm.start_servers = 2 22 | pm.min_spare_servers = 1 23 | pm.max_spare_servers = 3 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2015 Docker, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About this Repo 2 | 3 | This is the Git repo of the official Docker image for [php](https://registry.hub.docker.com/_/php/). See the 4 | Hub page for the full readme on how to use the Docker image and for information 5 | regarding contributing and issues. 6 | 7 | The full readme is generated over in [docker-library/docs](https://github.com/docker-library/docs), 8 | specificially in [docker-library/docs/php](https://github.com/docker-library/docs/tree/master/php). 9 | -------------------------------------------------------------------------------- /apache-Dockerfile-block-1: -------------------------------------------------------------------------------- 1 | RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* 2 | 3 | RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html 4 | 5 | # Apache + PHP requires preforking Apache for best results 6 | RUN a2dismod mpm_event && a2enmod mpm_prefork 7 | 8 | RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist 9 | COPY apache2.conf /etc/apache2/apache2.conf 10 | # it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation 11 | 12 | ENV PHP_EXTRA_BUILD_DEPS apache2-dev 13 | ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 14 | -------------------------------------------------------------------------------- /apache-Dockerfile-block-2: -------------------------------------------------------------------------------- 1 | COPY apache2-foreground /usr/local/bin/ 2 | WORKDIR /var/www/html 3 | 4 | EXPOSE 80 5 | CMD ["apache2-foreground"] 6 | -------------------------------------------------------------------------------- /docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | ext="$1" 5 | extDir="/usr/src/php/ext/$ext" 6 | if [ -z "$ext" -o ! -d "$extDir" ]; then 7 | echo >&2 "usage: $0 ext-name [configure flags]" 8 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 9 | echo >&2 10 | echo >&2 'Possible values for ext-name:' 11 | echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 12 | exit 1 13 | fi 14 | shift 15 | 16 | set -x 17 | cd "$extDir" 18 | phpize 19 | ./configure "$@" 20 | -------------------------------------------------------------------------------- /docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd /usr/src/php/ext 5 | 6 | usage() { 7 | echo "usage: $0 ext-name [ext-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo 11 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 12 | echo 13 | echo 'Possible values for ext-name:' 14 | echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) 15 | } 16 | 17 | exts=() 18 | while [ $# -gt 0 ]; do 19 | ext="$1" 20 | shift 21 | if [ -z "$ext" ]; then 22 | continue 23 | fi 24 | if [ ! -d "$ext" ]; then 25 | echo >&2 "error: $(pwd -P)/$ext does not exist" 26 | echo >&2 27 | usage >&2 28 | exit 1 29 | fi 30 | exts+=( "$ext" ) 31 | done 32 | 33 | if [ "${#exts[@]}" -eq 0 ]; then 34 | usage >&2 35 | exit 1 36 | fi 37 | 38 | for ext in "${exts[@]}"; do 39 | ( 40 | cd "$ext" 41 | [ -e Makefile ] || docker-php-ext-configure "$ext" 42 | make 43 | make install 44 | ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" 45 | for module in modules/*.so; do 46 | if [ -f "$module" ]; then 47 | if grep -q zend_extension_entry "$module"; then 48 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 49 | line="zend_extension=$(basename "$module")" 50 | else 51 | line="extension=$(basename "$module")" 52 | fi 53 | if ! grep -q "$line" "$ini"; then 54 | echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" 55 | fi 56 | fi 57 | done 58 | make clean 59 | ) 60 | done 61 | -------------------------------------------------------------------------------- /fpm-Dockerfile-block-1: -------------------------------------------------------------------------------- 1 | ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 2 | -------------------------------------------------------------------------------- /fpm-Dockerfile-block-2: -------------------------------------------------------------------------------- 1 | WORKDIR /var/www/html 2 | COPY php-fpm.conf /usr/local/etc/ 3 | 4 | EXPOSE 9000 5 | CMD ["php-fpm"] 6 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | declare -A aliases 5 | aliases=( 6 | [5.6]='5 latest' 7 | ) 8 | 9 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 10 | 11 | versions=( */ ) 12 | versions=( "${versions[@]%/}" ) 13 | url='git://github.com/docker-library/php' 14 | 15 | echo '# maintainer: InfoSiftr (@infosiftr)' 16 | 17 | for version in "${versions[@]}"; do 18 | commit="$(git log -1 --format='format:%H' -- "$version")" 19 | fullVersion="$(grep -m1 'ENV PHP_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)" 20 | versionAliases=( $fullVersion $version ${aliases[$version]} ) 21 | 22 | echo 23 | for va in "${versionAliases[@]}"; do 24 | if [ "$va" = 'latest' ]; then 25 | va='cli' 26 | else 27 | va="$va-cli" 28 | fi 29 | echo "$va: ${url}@${commit} $version" 30 | done 31 | for va in "${versionAliases[@]}"; do 32 | echo "$va: ${url}@${commit} $version" 33 | done 34 | 35 | for variant in apache fpm; do 36 | commit="$(git log -1 --format='format:%H' -- "$version/$variant")" 37 | echo 38 | for va in "${versionAliases[@]}"; do 39 | if [ "$va" = 'latest' ]; then 40 | va="$variant" 41 | else 42 | va="$va-$variant" 43 | fi 44 | echo "$va: ${url}@${commit} $version/$variant" 45 | done 46 | done 47 | done 48 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | declare -A gpgKeys 5 | gpgKeys=( 6 | [5.6]='6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1' 7 | [5.5]='0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D' 8 | [5.4]='F38252826ACD957EF380D39F2F7956BC5DA04B5D' 9 | [5.3]='0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7' 10 | ) 11 | # see http://php.net/downloads.php 12 | 13 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 14 | 15 | versions=( "$@" ) 16 | if [ ${#versions[@]} -eq 0 ]; then 17 | versions=( */ ) 18 | fi 19 | versions=( "${versions[@]%/}" ) 20 | 21 | packagesUrl='http://php.net/releases/index.php?serialize=1&version=5&max=100' 22 | packages="$(echo "$packagesUrl" | sed -r 's/[^a-zA-Z.-]+/-/g')" 23 | curl -sSL "${packagesUrl}" > "$packages" 24 | 25 | for version in "${versions[@]}"; do 26 | fullVersion="$(sed 's/;/;\n/g' $packages | grep -e 'php-'"$version"'.*\.tar\.bz2' | sed -r 's/.*php-('"$version"'[^"]+)\.tar\.bz2.*/\1/' | sort -V | tail -1)" 27 | gpgKey="${gpgKeys[$version]}" 28 | if [ -z "$gpgKey" ]; then 29 | echo >&2 "ERROR: missing GPG key fingerprint for $version" 30 | echo >&2 " try looking on http://php.net/downloads.php#gpg-$version" 31 | exit 1 32 | fi 33 | 34 | ( set -x; cp docker-php-ext-* "$version/" ) 35 | 36 | for variant in apache fpm; do 37 | echo "Generating $version/$variant/Dockerfile from $variant-Dockerfile-block-*" 38 | awk ' 39 | $1 == "####" { ia = 0 } 40 | !ia { print } 41 | $1 == "####" { ia = 1; ab++; ac = 0 } 42 | ia { ac++ } 43 | ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) } 44 | ' "$version/Dockerfile" > "$version/$variant/Dockerfile" 45 | ( set -x; cp docker-php-ext-* "$version/$variant/" ) 46 | done 47 | 48 | ( 49 | set -x 50 | sed -ri ' 51 | s/^(ENV PHP_VERSION) .*/\1 '"$fullVersion"'/; 52 | s/^(RUN gpg .* --recv-keys) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/ 53 | ' "$version/Dockerfile" "$version/"*/Dockerfile 54 | ) 55 | done 56 | 57 | rm "$packages" 58 | --------------------------------------------------------------------------------