-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from mikk150/master
add zts support
- Loading branch information
Showing
16 changed files
with
663 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
FROM debian:jessie | ||
|
||
# persistent / runtime deps | ||
RUN apt-get update && apt-get install -y ca-certificates curl librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* | ||
|
||
# phpize deps | ||
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --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 | ||
|
||
##<autogenerated>## | ||
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts | ||
##</autogenerated>## | ||
|
||
ENV GPG_KEYS 0B96609E270F565C13292B24C13C70B87267B52D 0BD78B5F97500D450838F95DFE857D9A90D90EC1 F38252826ACD957EF380D39F2F7956BC5DA04B5D | ||
RUN set -xe \ | ||
&& for key in $GPG_KEYS; do \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ | ||
done | ||
|
||
ENV PHP_VERSION 5.5.30 | ||
ENV PHP_FILENAME php-5.5.30.tar.xz | ||
ENV PHP_SHA256 d00dc06fa5e0f3de048fb0cf940b3cc59b43b3f8cad825d4fffb35503cf2e8f2 | ||
|
||
# --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 \ | ||
libcurl4-openssl-dev \ | ||
libreadline6-dev \ | ||
librecode-dev \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
xz-utils \ | ||
" \ | ||
&& set -x \ | ||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ | ||
&& curl -fSL "http://php.net/get/$PHP_FILENAME/from/this/mirror" -o "$PHP_FILENAME" \ | ||
&& echo "$PHP_SHA256 *$PHP_FILENAME" | sha256sum -c - \ | ||
&& curl -fSL "http://php.net/get/$PHP_FILENAME.asc/from/this/mirror" -o "$PHP_FILENAME.asc" \ | ||
&& gpg --verify "$PHP_FILENAME.asc" \ | ||
&& mkdir -p /usr/src/php \ | ||
&& tar -xf "$PHP_FILENAME" -C /usr/src/php --strip-components=1 \ | ||
&& rm "$PHP_FILENAME"* \ | ||
&& 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-recode \ | ||
--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 -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ | ||
&& make clean | ||
|
||
COPY docker-php-ext-* /usr/local/bin/ | ||
|
||
##<autogenerated>## | ||
CMD ["php", "-a"] | ||
##</autogenerated>## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "$(php -r 'echo ini_get("extension_dir");')" | ||
|
||
usage() { | ||
echo "usage: $0 module-name [module-name ...]" | ||
echo " ie: $0 gd mysqli" | ||
echo " $0 pdo pdo_mysql" | ||
echo | ||
echo 'Possible values for module-name:' | ||
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) | ||
} | ||
|
||
modules=() | ||
while [ $# -gt 0 ]; do | ||
module="$1" | ||
shift | ||
if [ -z "$module" ]; then | ||
continue | ||
fi | ||
if [ -f "$module.so" -a ! -f "$module" ]; then | ||
# allow ".so" to be optional | ||
module+='.so' | ||
fi | ||
if [ ! -f "$module" ]; then | ||
echo >&2 "error: $(readlink -f "$module") does not exist" | ||
echo >&2 | ||
usage >&2 | ||
exit 1 | ||
fi | ||
modules+=( "$module" ) | ||
done | ||
|
||
if [ "${#modules[@]}" -eq 0 ]; then | ||
usage >&2 | ||
exit 1 | ||
fi | ||
|
||
for module in "${modules[@]}"; do | ||
if grep -q zend_extension_entry "$module"; then | ||
# https://wiki.php.net/internals/extensions#loading_zend_extensions | ||
line="zend_extension=$(readlink -f "$module")" | ||
else | ||
line="extension=$module" | ||
fi | ||
|
||
ext="$(basename "$module")" | ||
ext="${ext%.*}" | ||
if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then | ||
# this isn't perfect, but it's better than nothing | ||
# (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') | ||
echo >&2 | ||
echo >&2 "warning: $ext ($module) is already loaded!" | ||
echo >&2 | ||
continue | ||
fi | ||
|
||
ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" | ||
if ! grep -q "$line" "$ini" 2>/dev/null; then | ||
echo "$line" >> "$ini" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd /usr/src/php/ext | ||
|
||
usage() { | ||
echo "usage: $0 [-jN] ext-name [ext-name ...]" | ||
echo " ie: $0 gd mysqli" | ||
echo " $0 pdo pdo_mysql" | ||
echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" | ||
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) | ||
} | ||
|
||
opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" | ||
eval set -- "$opts" | ||
|
||
j=1 | ||
while true; do | ||
flag="$1" | ||
shift | ||
case "$flag" in | ||
--help|-h|'-?') usage && exit 0 ;; | ||
--jobs|-j) j="$1" && shift ;; | ||
--) break ;; | ||
*) | ||
{ | ||
echo "error: unknown flag: $flag" | ||
usage | ||
} >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
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 -j"$j" | ||
make -j"$j" install | ||
find modules -maxdepth 1 -name '*.so' -exec basename '{}' ';' | xargs --no-run-if-empty --verbose docker-php-ext-enable | ||
make -j"$j" clean | ||
) | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
FROM debian:jessie | ||
|
||
# persistent / runtime deps | ||
RUN apt-get update && apt-get install -y ca-certificates curl librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* | ||
|
||
# phpize deps | ||
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --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 | ||
|
||
##<autogenerated>## | ||
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts | ||
##</autogenerated>## | ||
|
||
ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 | ||
RUN set -xe \ | ||
&& for key in $GPG_KEYS; do \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ | ||
done | ||
|
||
ENV PHP_VERSION 5.6.16 | ||
ENV PHP_FILENAME php-5.6.16.tar.xz | ||
ENV PHP_SHA256 8ef43271d9bd8cc8f8d407d3ba569de9fa14a28985ae97c76085bb50d597de98 | ||
|
||
# --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 \ | ||
libcurl4-openssl-dev \ | ||
libreadline6-dev \ | ||
librecode-dev \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
xz-utils \ | ||
" \ | ||
&& set -x \ | ||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ | ||
&& curl -fSL "http://php.net/get/$PHP_FILENAME/from/this/mirror" -o "$PHP_FILENAME" \ | ||
&& echo "$PHP_SHA256 *$PHP_FILENAME" | sha256sum -c - \ | ||
&& curl -fSL "http://php.net/get/$PHP_FILENAME.asc/from/this/mirror" -o "$PHP_FILENAME.asc" \ | ||
&& gpg --verify "$PHP_FILENAME.asc" \ | ||
&& mkdir -p /usr/src/php \ | ||
&& tar -xf "$PHP_FILENAME" -C /usr/src/php --strip-components=1 \ | ||
&& rm "$PHP_FILENAME"* \ | ||
&& 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-recode \ | ||
--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 -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \ | ||
&& make clean | ||
|
||
COPY docker-php-ext-* /usr/local/bin/ | ||
|
||
##<autogenerated>## | ||
CMD ["php", "-a"] | ||
##</autogenerated>## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "$(php -r 'echo ini_get("extension_dir");')" | ||
|
||
usage() { | ||
echo "usage: $0 module-name [module-name ...]" | ||
echo " ie: $0 gd mysqli" | ||
echo " $0 pdo pdo_mysql" | ||
echo | ||
echo 'Possible values for module-name:' | ||
echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) | ||
} | ||
|
||
modules=() | ||
while [ $# -gt 0 ]; do | ||
module="$1" | ||
shift | ||
if [ -z "$module" ]; then | ||
continue | ||
fi | ||
if [ -f "$module.so" -a ! -f "$module" ]; then | ||
# allow ".so" to be optional | ||
module+='.so' | ||
fi | ||
if [ ! -f "$module" ]; then | ||
echo >&2 "error: $(readlink -f "$module") does not exist" | ||
echo >&2 | ||
usage >&2 | ||
exit 1 | ||
fi | ||
modules+=( "$module" ) | ||
done | ||
|
||
if [ "${#modules[@]}" -eq 0 ]; then | ||
usage >&2 | ||
exit 1 | ||
fi | ||
|
||
for module in "${modules[@]}"; do | ||
if grep -q zend_extension_entry "$module"; then | ||
# https://wiki.php.net/internals/extensions#loading_zend_extensions | ||
line="zend_extension=$(readlink -f "$module")" | ||
else | ||
line="extension=$module" | ||
fi | ||
|
||
ext="$(basename "$module")" | ||
ext="${ext%.*}" | ||
if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then | ||
# this isn't perfect, but it's better than nothing | ||
# (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') | ||
echo >&2 | ||
echo >&2 "warning: $ext ($module) is already loaded!" | ||
echo >&2 | ||
continue | ||
fi | ||
|
||
ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" | ||
if ! grep -q "$line" "$ini" 2>/dev/null; then | ||
echo "$line" >> "$ini" | ||
fi | ||
done |
Oops, something went wrong.