diff --git a/5.4/fpm/Dockerfile b/5.4/fpm/Dockerfile
new file mode 100644
index 00000000..ce8461ee
--- /dev/null
+++ b/5.4/fpm/Dockerfile
@@ -0,0 +1,63 @@
+FROM debian:jessie
+
+# persistent / runtime deps
+RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+# phpize deps
+RUN apt-get update && apt-get install -y autoconf gcc make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+ENV PHP_INI_DIR /usr/local/etc/php
+RUN mkdir -p $PHP_INI_DIR/conf.d
+
+####
+ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
+####
+
+RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
+
+ENV PHP_VERSION 5.4.34
+
+# --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)
+RUN buildDeps=" \
+ $PHP_EXTRA_BUILD_DEPS \
+ bzip2 \
+ file \
+ libcurl4-openssl-dev \
+ libreadline6-dev \
+ libssl-dev \
+ libxml2-dev \
+ "; \
+ set -x \
+ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
+ && gpg --verify php.tar.bz2.asc \
+ && mkdir -p /usr/src/php \
+ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
+ && rm php.tar.bz2* \
+ && cd /usr/src/php \
+ && ./configure \
+ --with-config-file-path="$PHP_INI_DIR" \
+ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
+ $PHP_EXTRA_CONFIGURE_ARGS \
+ --disable-cgi \
+ --enable-mysqlnd \
+ --with-curl \
+ --with-openssl \
+ --with-readline \
+ --with-zlib \
+ && make -j"$(nproc)" \
+ && make install \
+ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
+ && apt-get purge -y --auto-remove $buildDeps \
+ && make clean
+
+COPY docker-php-ext-* /usr/local/bin/
+
+####
+WORKDIR /var/www/html
+COPY php-fpm.conf /usr/local/etc/
+
+EXPOSE 9000
+CMD ["php-fpm"]
+####
diff --git a/5.4/fpm/docker-php-ext-configure b/5.4/fpm/docker-php-ext-configure
new file mode 100755
index 00000000..3d21b5bb
--- /dev/null
+++ b/5.4/fpm/docker-php-ext-configure
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+
+ext="$1"
+extDir="/usr/src/php/ext/$ext"
+if [ -z "$ext" -o ! -d "$extDir" ]; then
+ echo >&2 "usage: $0 ext-name [configure flags]"
+ echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
+ echo >&2
+ echo >&2 'Possible values for ext-name:'
+ echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+ exit 1
+fi
+shift
+
+set -x
+cd "$extDir"
+phpize
+./configure "$@"
diff --git a/5.4/fpm/docker-php-ext-install b/5.4/fpm/docker-php-ext-install
new file mode 100755
index 00000000..abca7fff
--- /dev/null
+++ b/5.4/fpm/docker-php-ext-install
@@ -0,0 +1,55 @@
+#!/bin/bash
+set -e
+
+cd /usr/src/php/ext
+
+usage() {
+ echo "usage: $0 ext-name [ext-name ...]"
+ echo " ie: $0 gd mysqli"
+ echo " $0 pdo pdo_mysql"
+ echo
+ echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
+ echo
+ echo 'Possible values for ext-name:'
+ echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+}
+
+exts=()
+while [ $# -gt 0 ]; do
+ ext="$1"
+ shift
+ if [ -z "$ext" ]; then
+ continue
+ fi
+ if [ ! -d "$ext" ]; then
+ echo >&2 "error: $(pwd -P)/$ext does not exist"
+ echo >&2
+ usage >&2
+ exit 1
+ fi
+ exts+=( "$ext" )
+done
+
+if [ "${#exts[@]}" -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+for ext in "${exts[@]}"; do
+ (
+ cd "$ext"
+ [ -e Makefile ] || docker-php-ext-configure "$ext"
+ make
+ make install
+ ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
+ for module in modules/*.so; do
+ if [ -f "$module" ]; then
+ line="extension=$(basename "$module")"
+ if ! grep -q "$line" "$ini"; then
+ echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini"
+ fi
+ fi
+ done
+ make clean
+ )
+done
diff --git a/5.4/fpm/php-fpm.conf b/5.4/fpm/php-fpm.conf
new file mode 100644
index 00000000..6a74b972
--- /dev/null
+++ b/5.4/fpm/php-fpm.conf
@@ -0,0 +1,23 @@
+; This file was initially adapated from the output of: (on PHP 5.6)
+; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
+
+[global]
+
+error_log = /proc/self/fd/2
+daemonize = no
+
+[www]
+
+; if we send this to /proc/self/fd/1, it never appears
+access.log = /proc/self/fd/2
+
+user = www-data
+group = www-data
+
+listen = 9000
+
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
diff --git a/5.5/fpm/Dockerfile b/5.5/fpm/Dockerfile
new file mode 100644
index 00000000..9ac66327
--- /dev/null
+++ b/5.5/fpm/Dockerfile
@@ -0,0 +1,63 @@
+FROM debian:jessie
+
+# persistent / runtime deps
+RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+# phpize deps
+RUN apt-get update && apt-get install -y autoconf gcc make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+ENV PHP_INI_DIR /usr/local/etc/php
+RUN mkdir -p $PHP_INI_DIR/conf.d
+
+####
+ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
+####
+
+RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
+
+ENV PHP_VERSION 5.5.18
+
+# --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)
+RUN buildDeps=" \
+ $PHP_EXTRA_BUILD_DEPS \
+ bzip2 \
+ file \
+ libcurl4-openssl-dev \
+ libreadline6-dev \
+ libssl-dev \
+ libxml2-dev \
+ "; \
+ set -x \
+ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
+ && gpg --verify php.tar.bz2.asc \
+ && mkdir -p /usr/src/php \
+ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
+ && rm php.tar.bz2* \
+ && cd /usr/src/php \
+ && ./configure \
+ --with-config-file-path="$PHP_INI_DIR" \
+ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
+ $PHP_EXTRA_CONFIGURE_ARGS \
+ --disable-cgi \
+ --enable-mysqlnd \
+ --with-curl \
+ --with-openssl \
+ --with-readline \
+ --with-zlib \
+ && make -j"$(nproc)" \
+ && make install \
+ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
+ && apt-get purge -y --auto-remove $buildDeps \
+ && make clean
+
+COPY docker-php-ext-* /usr/local/bin/
+
+####
+WORKDIR /var/www/html
+COPY php-fpm.conf /usr/local/etc/
+
+EXPOSE 9000
+CMD ["php-fpm"]
+####
diff --git a/5.5/fpm/docker-php-ext-configure b/5.5/fpm/docker-php-ext-configure
new file mode 100755
index 00000000..3d21b5bb
--- /dev/null
+++ b/5.5/fpm/docker-php-ext-configure
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+
+ext="$1"
+extDir="/usr/src/php/ext/$ext"
+if [ -z "$ext" -o ! -d "$extDir" ]; then
+ echo >&2 "usage: $0 ext-name [configure flags]"
+ echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
+ echo >&2
+ echo >&2 'Possible values for ext-name:'
+ echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+ exit 1
+fi
+shift
+
+set -x
+cd "$extDir"
+phpize
+./configure "$@"
diff --git a/5.5/fpm/docker-php-ext-install b/5.5/fpm/docker-php-ext-install
new file mode 100755
index 00000000..abca7fff
--- /dev/null
+++ b/5.5/fpm/docker-php-ext-install
@@ -0,0 +1,55 @@
+#!/bin/bash
+set -e
+
+cd /usr/src/php/ext
+
+usage() {
+ echo "usage: $0 ext-name [ext-name ...]"
+ echo " ie: $0 gd mysqli"
+ echo " $0 pdo pdo_mysql"
+ echo
+ echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
+ echo
+ echo 'Possible values for ext-name:'
+ echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+}
+
+exts=()
+while [ $# -gt 0 ]; do
+ ext="$1"
+ shift
+ if [ -z "$ext" ]; then
+ continue
+ fi
+ if [ ! -d "$ext" ]; then
+ echo >&2 "error: $(pwd -P)/$ext does not exist"
+ echo >&2
+ usage >&2
+ exit 1
+ fi
+ exts+=( "$ext" )
+done
+
+if [ "${#exts[@]}" -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+for ext in "${exts[@]}"; do
+ (
+ cd "$ext"
+ [ -e Makefile ] || docker-php-ext-configure "$ext"
+ make
+ make install
+ ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
+ for module in modules/*.so; do
+ if [ -f "$module" ]; then
+ line="extension=$(basename "$module")"
+ if ! grep -q "$line" "$ini"; then
+ echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini"
+ fi
+ fi
+ done
+ make clean
+ )
+done
diff --git a/5.5/fpm/php-fpm.conf b/5.5/fpm/php-fpm.conf
new file mode 100644
index 00000000..6a74b972
--- /dev/null
+++ b/5.5/fpm/php-fpm.conf
@@ -0,0 +1,23 @@
+; This file was initially adapated from the output of: (on PHP 5.6)
+; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
+
+[global]
+
+error_log = /proc/self/fd/2
+daemonize = no
+
+[www]
+
+; if we send this to /proc/self/fd/1, it never appears
+access.log = /proc/self/fd/2
+
+user = www-data
+group = www-data
+
+listen = 9000
+
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
diff --git a/5.6/fpm/Dockerfile b/5.6/fpm/Dockerfile
new file mode 100644
index 00000000..d5f9b628
--- /dev/null
+++ b/5.6/fpm/Dockerfile
@@ -0,0 +1,63 @@
+FROM debian:jessie
+
+# persistent / runtime deps
+RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+# phpize deps
+RUN apt-get update && apt-get install -y autoconf gcc make pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+ENV PHP_INI_DIR /usr/local/etc/php
+RUN mkdir -p $PHP_INI_DIR/conf.d
+
+####
+ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
+####
+
+RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1
+
+ENV PHP_VERSION 5.6.2
+
+# --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)
+RUN buildDeps=" \
+ $PHP_EXTRA_BUILD_DEPS \
+ bzip2 \
+ file \
+ libcurl4-openssl-dev \
+ libreadline6-dev \
+ libssl-dev \
+ libxml2-dev \
+ "; \
+ set -x \
+ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
+ && gpg --verify php.tar.bz2.asc \
+ && mkdir -p /usr/src/php \
+ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
+ && rm php.tar.bz2* \
+ && cd /usr/src/php \
+ && ./configure \
+ --with-config-file-path="$PHP_INI_DIR" \
+ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
+ $PHP_EXTRA_CONFIGURE_ARGS \
+ --disable-cgi \
+ --enable-mysqlnd \
+ --with-curl \
+ --with-openssl \
+ --with-readline \
+ --with-zlib \
+ && make -j"$(nproc)" \
+ && make install \
+ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
+ && apt-get purge -y --auto-remove $buildDeps \
+ && make clean
+
+COPY docker-php-ext-* /usr/local/bin/
+
+####
+WORKDIR /var/www/html
+COPY php-fpm.conf /usr/local/etc/
+
+EXPOSE 9000
+CMD ["php-fpm"]
+####
diff --git a/5.6/fpm/docker-php-ext-configure b/5.6/fpm/docker-php-ext-configure
new file mode 100755
index 00000000..3d21b5bb
--- /dev/null
+++ b/5.6/fpm/docker-php-ext-configure
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+
+ext="$1"
+extDir="/usr/src/php/ext/$ext"
+if [ -z "$ext" -o ! -d "$extDir" ]; then
+ echo >&2 "usage: $0 ext-name [configure flags]"
+ echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
+ echo >&2
+ echo >&2 'Possible values for ext-name:'
+ echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+ exit 1
+fi
+shift
+
+set -x
+cd "$extDir"
+phpize
+./configure "$@"
diff --git a/5.6/fpm/docker-php-ext-install b/5.6/fpm/docker-php-ext-install
new file mode 100755
index 00000000..abca7fff
--- /dev/null
+++ b/5.6/fpm/docker-php-ext-install
@@ -0,0 +1,55 @@
+#!/bin/bash
+set -e
+
+cd /usr/src/php/ext
+
+usage() {
+ echo "usage: $0 ext-name [ext-name ...]"
+ echo " ie: $0 gd mysqli"
+ echo " $0 pdo pdo_mysql"
+ echo
+ echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
+ echo
+ echo 'Possible values for ext-name:'
+ echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+}
+
+exts=()
+while [ $# -gt 0 ]; do
+ ext="$1"
+ shift
+ if [ -z "$ext" ]; then
+ continue
+ fi
+ if [ ! -d "$ext" ]; then
+ echo >&2 "error: $(pwd -P)/$ext does not exist"
+ echo >&2
+ usage >&2
+ exit 1
+ fi
+ exts+=( "$ext" )
+done
+
+if [ "${#exts[@]}" -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+for ext in "${exts[@]}"; do
+ (
+ cd "$ext"
+ [ -e Makefile ] || docker-php-ext-configure "$ext"
+ make
+ make install
+ ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
+ for module in modules/*.so; do
+ if [ -f "$module" ]; then
+ line="extension=$(basename "$module")"
+ if ! grep -q "$line" "$ini"; then
+ echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini"
+ fi
+ fi
+ done
+ make clean
+ )
+done
diff --git a/5.6/fpm/php-fpm.conf b/5.6/fpm/php-fpm.conf
new file mode 100644
index 00000000..6a74b972
--- /dev/null
+++ b/5.6/fpm/php-fpm.conf
@@ -0,0 +1,23 @@
+; This file was initially adapated from the output of: (on PHP 5.6)
+; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
+
+[global]
+
+error_log = /proc/self/fd/2
+daemonize = no
+
+[www]
+
+; if we send this to /proc/self/fd/1, it never appears
+access.log = /proc/self/fd/2
+
+user = www-data
+group = www-data
+
+listen = 9000
+
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
diff --git a/fpm-Dockerfile-block-1 b/fpm-Dockerfile-block-1
new file mode 100644
index 00000000..959fd928
--- /dev/null
+++ b/fpm-Dockerfile-block-1
@@ -0,0 +1 @@
+ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
diff --git a/fpm-Dockerfile-block-2 b/fpm-Dockerfile-block-2
new file mode 100644
index 00000000..e9989491
--- /dev/null
+++ b/fpm-Dockerfile-block-2
@@ -0,0 +1,5 @@
+WORKDIR /var/www/html
+COPY php-fpm.conf /usr/local/etc/
+
+EXPOSE 9000
+CMD ["php-fpm"]
diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh
index c555f49b..72153975 100755
--- a/generate-stackbrew-library.sh
+++ b/generate-stackbrew-library.sh
@@ -15,7 +15,7 @@ url='git://github.com/docker-library/php'
echo '# maintainer: InfoSiftr (@infosiftr)'
for version in "${versions[@]}"; do
- commit="$(git log -1 --format='format:%H' "$version")"
+ commit="$(git log -1 --format='format:%H' -- "$version")"
fullVersion="$(grep -m1 'ENV PHP_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
versionAliases=( $fullVersion $version ${aliases[$version]} )
@@ -32,8 +32,8 @@ for version in "${versions[@]}"; do
echo "$va: ${url}@${commit} $version"
done
- for variant in apache; do
- commit="$(git log -1 --format='format:%H' "$version/$variant")"
+ for variant in apache fpm; do
+ commit="$(git log -1 --format='format:%H' -- "$version/$variant")"
echo
for va in "${versionAliases[@]}"; do
if [ "$va" = 'latest' ]; then
diff --git a/php-fpm.conf b/php-fpm.conf
new file mode 100644
index 00000000..6a74b972
--- /dev/null
+++ b/php-fpm.conf
@@ -0,0 +1,23 @@
+; This file was initially adapated from the output of: (on PHP 5.6)
+; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
+
+[global]
+
+error_log = /proc/self/fd/2
+daemonize = no
+
+[www]
+
+; if we send this to /proc/self/fd/1, it never appears
+access.log = /proc/self/fd/2
+
+user = www-data
+group = www-data
+
+listen = 9000
+
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
diff --git a/update.sh b/update.sh
index b5e29c78..63bb7231 100755
--- a/update.sh
+++ b/update.sh
@@ -31,7 +31,9 @@ for version in "${versions[@]}"; do
exit 1
fi
- for variant in apache; do
+ ( set -x; cp docker-php-ext-* "$version/" )
+
+ for variant in apache fpm; do
echo "Generating $version/$variant/Dockerfile from $variant-Dockerfile-block-*"
awk '
$1 == "####" { ia = 0 }
@@ -40,6 +42,7 @@ for version in "${versions[@]}"; do
ia { ac++ }
ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) }
' "$version/Dockerfile" > "$version/$variant/Dockerfile"
+ ( set -x; cp docker-php-ext-* "$version/$variant/" )
done
(
@@ -49,9 +52,8 @@ for version in "${versions[@]}"; do
s/^(RUN gpg .* --recv-keys) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/
' "$version/Dockerfile"
- cp docker-php-ext-* "$version/"
- cp docker-php-ext-* "$version/apache/"
cp apache2.conf "$version/apache/"
+ cp php-fpm.conf "$version/fpm/"
)
done