first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
This commit is contained in:
156
base/php/5.4.1/apache/Dockerfile
Normal file
156
base/php/5.4.1/apache/Dockerfile
Normal file
@@ -0,0 +1,156 @@
|
||||
FROM debian:jessie
|
||||
|
||||
LABEL maintainer="phithon <root@leavesongs.com>"
|
||||
|
||||
# persistent / runtime deps
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
librecode0 \
|
||||
libmysqlclient-dev \
|
||||
libsqlite3-0 \
|
||||
libxml2 \
|
||||
&& apt-get clean \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# phpize deps
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
libc-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
re2c \
|
||||
&& apt-get clean \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
ENV PHP_INI_DIR /usr/local/etc/php
|
||||
RUN mkdir -p $PHP_INI_DIR/conf.d
|
||||
|
||||
# compile openssl, otherwise --with-openssl won't work
|
||||
RUN OPENSSL_VERSION="1.0.2k" \
|
||||
&& cd /tmp \
|
||||
&& mkdir openssl \
|
||||
&& curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
|
||||
&& tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
|
||||
&& cd /tmp/openssl \
|
||||
&& ./config -fPIC && make && make install \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
ENV PHP_VERSION 5.4.1
|
||||
|
||||
##<autogenerated>##
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apache2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV APACHE_CONFDIR /etc/apache2
|
||||
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
|
||||
|
||||
RUN set -ex \
|
||||
\
|
||||
# generically convert lines like
|
||||
# export APACHE_RUN_USER=www-data
|
||||
# into
|
||||
# : ${APACHE_RUN_USER:=www-data}
|
||||
# export APACHE_RUN_USER
|
||||
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
|
||||
&& sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
|
||||
\
|
||||
# setup directories and permissions
|
||||
&& . "$APACHE_ENVVARS" \
|
||||
&& for dir in \
|
||||
"$APACHE_LOCK_DIR" \
|
||||
"$APACHE_RUN_DIR" \
|
||||
"$APACHE_LOG_DIR" \
|
||||
/var/www/html \
|
||||
; do \
|
||||
rm -rvf "$dir" \
|
||||
&& mkdir -p "$dir" \
|
||||
&& chown -R "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
|
||||
done
|
||||
|
||||
# Apache + PHP requires preforking Apache for best results
|
||||
RUN a2dismod mpm_event && a2enmod mpm_prefork
|
||||
|
||||
# logs should go to stdout / stderr
|
||||
RUN set -ex \
|
||||
&& . "$APACHE_ENVVARS" \
|
||||
&& ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \
|
||||
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \
|
||||
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"
|
||||
|
||||
# PHP files should be handled by PHP, and should be preferred over any other file type
|
||||
RUN { \
|
||||
echo '<FilesMatch \.php$>'; \
|
||||
echo '\tSetHandler application/x-httpd-php'; \
|
||||
echo '</FilesMatch>'; \
|
||||
echo; \
|
||||
echo 'DirectoryIndex disabled'; \
|
||||
echo 'DirectoryIndex index.php index.html'; \
|
||||
echo; \
|
||||
echo '<Directory /var/www/>'; \
|
||||
echo '\tOptions -Indexes'; \
|
||||
echo '\tAllowOverride All'; \
|
||||
echo '</Directory>'; \
|
||||
} | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \
|
||||
&& a2enconf docker-php
|
||||
|
||||
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
|
||||
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
|
||||
##</autogenerated>##
|
||||
|
||||
RUN set -ex \
|
||||
&& mkdir /tmp/libxml \
|
||||
&& cd /tmp/libxml \
|
||||
&& curl -#sSL http://xmlsoft.org/sources/libxml2-2.8.0.tar.gz | tar xz --strip-components=1 \
|
||||
&& ./configure && make && make install && make clean \
|
||||
&& rm -rf /tmp/libxml
|
||||
|
||||
# php 5.4.1 needs older autoconf
|
||||
# --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=" \
|
||||
autoconf2.13 \
|
||||
libcurl4-openssl-dev \
|
||||
libreadline6-dev \
|
||||
librecode-dev \
|
||||
libsqlite3-dev \
|
||||
libssl-dev \
|
||||
xz-utils \
|
||||
apache2-dev \
|
||||
" \
|
||||
&& set -x \
|
||||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /usr/src/php \
|
||||
&& curl -#SL "http://museum.php.net/php5/php-${PHP_VERSION}.tar.gz" | tar zx -C /usr/src/php --strip-components=1 \
|
||||
&& cd /usr/src/php \
|
||||
&& ./configure \
|
||||
--with-config-file-path="$PHP_INI_DIR" \
|
||||
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
|
||||
--disable-cgi \
|
||||
--enable-mysqlnd \
|
||||
--enable-mbstring \
|
||||
--with-mysql \
|
||||
--with-curl \
|
||||
--with-openssl=/usr/local/ssl \
|
||||
--with-readline \
|
||||
--with-recode \
|
||||
--with-zlib \
|
||||
--with-apxs2 \
|
||||
&& 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-* apache2-foreground /usr/local/bin/
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["docker-php-entrypoint"]
|
||||
CMD ["apache2-foreground"]
|
40
base/php/5.4.1/apache/apache2-foreground
Normal file
40
base/php/5.4.1/apache/apache2-foreground
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background.
|
||||
# (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)
|
||||
|
||||
: "${APACHE_CONFDIR:=/etc/apache2}"
|
||||
: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}"
|
||||
if test -f "$APACHE_ENVVARS"; then
|
||||
. "$APACHE_ENVVARS"
|
||||
fi
|
||||
|
||||
# Apache gets grumpy about PID files pre-existing
|
||||
: "${APACHE_RUN_DIR:=/var/run/apache2}"
|
||||
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
|
||||
rm -f "$APACHE_PID_FILE"
|
||||
|
||||
# create missing directories
|
||||
# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR)
|
||||
for e in "${!APACHE_@}"; do
|
||||
if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then
|
||||
# handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir
|
||||
# mkdir: cannot create directory '/var/lock': File exists
|
||||
dir="${!e}"
|
||||
while [ "$dir" != "$(dirname "$dir")" ]; do
|
||||
dir="$(dirname "$dir")"
|
||||
if [ -d "$dir" ]; then
|
||||
break
|
||||
fi
|
||||
absDir="$(readlink -f "$dir" 2>/dev/null || :)"
|
||||
if [ -n "$absDir" ]; then
|
||||
mkdir -p "$absDir"
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "${!e}"
|
||||
fi
|
||||
done
|
||||
|
||||
exec apache2 -DFOREGROUND "$@"
|
9
base/php/5.4.1/apache/docker-php-entrypoint
Normal file
9
base/php/5.4.1/apache/docker-php-entrypoint
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- apache2-foreground "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
19
base/php/5.4.1/apache/docker-php-ext-configure
Normal file
19
base/php/5.4.1/apache/docker-php-ext-configure
Normal file
@@ -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 "$@"
|
60
base/php/5.4.1/apache/docker-php-ext-install
Normal file
60
base/php/5.4.1/apache/docker-php-ext-install
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/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
|
||||
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=$(basename "$module")"
|
||||
fi
|
||||
if ! grep -q "$line" "$ini" 2>/dev/null; then
|
||||
echo "$line" >> "$ini"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
make clean
|
||||
)
|
||||
done
|
40
base/php/5.4.1/cgi/Dockerfile
Normal file
40
base/php/5.4.1/cgi/Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM vulhub/php:5.4.1
|
||||
|
||||
LABEL maintainer="phithon <root@leavesongs.com>"
|
||||
|
||||
RUN set -ex \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apache2 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& \
|
||||
{ \
|
||||
echo; \
|
||||
echo '<Directory "/usr/local/bin">'; \
|
||||
echo ' Require all granted'; \
|
||||
echo ' Options ExecCGI'; \
|
||||
echo '</Directory>'; \
|
||||
echo; \
|
||||
echo 'ScriptAlias /local-bin /usr/local/bin'; \
|
||||
echo; \
|
||||
echo "<Directory \"/var/www/html\">"; \
|
||||
echo ' AddHandler application/x-httpd-php5 php'; \
|
||||
echo ' Action application/x-httpd-php5 /local-bin/php-cgi'; \
|
||||
echo ' Options -Indexes'; \
|
||||
echo ' Require all granted'; \
|
||||
echo ' DirectoryIndex index.html index.php'; \
|
||||
echo '</Directory>'; \
|
||||
echo; \
|
||||
} >> /etc/apache2/conf-available/php.conf \
|
||||
&& a2enmod cgid \
|
||||
&& a2enmod actions \
|
||||
&& a2disconf serve-cgi-bin \
|
||||
&& a2enconf php
|
||||
|
||||
COPY apache2-foreground /usr/local/bin/
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["apache2-foreground"]
|
40
base/php/5.4.1/cgi/apache2-foreground
Normal file
40
base/php/5.4.1/cgi/apache2-foreground
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background.
|
||||
# (also, when run as "apache2ctl <apache args>", it does not use "exec", which leaves an undesirable resident shell process)
|
||||
|
||||
: "${APACHE_CONFDIR:=/etc/apache2}"
|
||||
: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}"
|
||||
if test -f "$APACHE_ENVVARS"; then
|
||||
. "$APACHE_ENVVARS"
|
||||
fi
|
||||
|
||||
# Apache gets grumpy about PID files pre-existing
|
||||
: "${APACHE_RUN_DIR:=/var/run/apache2}"
|
||||
: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}"
|
||||
rm -f "$APACHE_PID_FILE"
|
||||
|
||||
# create missing directories
|
||||
# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR)
|
||||
for e in "${!APACHE_@}"; do
|
||||
if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then
|
||||
# handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir
|
||||
# mkdir: cannot create directory '/var/lock': File exists
|
||||
dir="${!e}"
|
||||
while [ "$dir" != "$(dirname "$dir")" ]; do
|
||||
dir="$(dirname "$dir")"
|
||||
if [ -d "$dir" ]; then
|
||||
break
|
||||
fi
|
||||
absDir="$(readlink -f "$dir" 2>/dev/null || :)"
|
||||
if [ -n "$absDir" ]; then
|
||||
mkdir -p "$absDir"
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "${!e}"
|
||||
fi
|
||||
done
|
||||
|
||||
exec apache2 -DFOREGROUND "$@"
|
87
base/php/5.4.1/cli/Dockerfile
Normal file
87
base/php/5.4.1/cli/Dockerfile
Normal file
@@ -0,0 +1,87 @@
|
||||
FROM debian:jessie
|
||||
|
||||
LABEL maintainer="phithon <root@leavesongs.com>"
|
||||
|
||||
# persistent / runtime deps
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
librecode0 \
|
||||
libmysqlclient-dev \
|
||||
libsqlite3-0 \
|
||||
libxml2 \
|
||||
&& apt-get clean \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
# phpize deps
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
autoconf \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
libc-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
re2c \
|
||||
&& apt-get clean \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
ENV PHP_INI_DIR /usr/local/etc/php
|
||||
RUN mkdir -p $PHP_INI_DIR/conf.d
|
||||
|
||||
# compile openssl, otherwise --with-openssl won't work
|
||||
RUN OPENSSL_VERSION="1.0.2k" \
|
||||
&& cd /tmp \
|
||||
&& mkdir openssl \
|
||||
&& curl -sL "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -o openssl.tar.gz \
|
||||
&& tar -xzf openssl.tar.gz -C openssl --strip-components=1 \
|
||||
&& cd /tmp/openssl \
|
||||
&& ./config -fPIC && make && make install \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
RUN set -ex \
|
||||
&& mkdir /tmp/libxml \
|
||||
&& cd /tmp/libxml \
|
||||
&& curl -#sSL http://xmlsoft.org/sources/libxml2-2.8.0.tar.gz | tar xz --strip-components=1 \
|
||||
&& ./configure && make && make install && make clean \
|
||||
&& rm -rf /tmp/libxml
|
||||
|
||||
ENV PHP_VERSION 5.4.1
|
||||
|
||||
# php 5.4.1 needs older autoconf
|
||||
# --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=" \
|
||||
autoconf2.13 \
|
||||
libcurl4-openssl-dev \
|
||||
libreadline6-dev \
|
||||
librecode-dev \
|
||||
libsqlite3-dev \
|
||||
libssl-dev \
|
||||
xz-utils \
|
||||
" \
|
||||
&& set -x \
|
||||
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /usr/src/php \
|
||||
&& curl -#SL "http://museum.php.net/php5/php-${PHP_VERSION}.tar.gz" | tar zx -C /usr/src/php --strip-components=1 \
|
||||
&& cd /usr/src/php \
|
||||
&& ./configure \
|
||||
--with-config-file-path="$PHP_INI_DIR" \
|
||||
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
|
||||
--enable-mysqlnd \
|
||||
--enable-mbstring \
|
||||
--with-mysql \
|
||||
--with-curl \
|
||||
--with-openssl=/usr/local/ssl \
|
||||
--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-* /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["docker-php-entrypoint"]
|
||||
CMD ["php", "-a"]
|
9
base/php/5.4.1/cli/docker-php-entrypoint
Normal file
9
base/php/5.4.1/cli/docker-php-entrypoint
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- php "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
19
base/php/5.4.1/cli/docker-php-ext-configure
Normal file
19
base/php/5.4.1/cli/docker-php-ext-configure
Normal file
@@ -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 "$@"
|
60
base/php/5.4.1/cli/docker-php-ext-install
Normal file
60
base/php/5.4.1/cli/docker-php-ext-install
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/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
|
||||
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=$(basename "$module")"
|
||||
fi
|
||||
if ! grep -q "$line" "$ini" 2>/dev/null; then
|
||||
echo "$line" >> "$ini"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
make clean
|
||||
)
|
||||
done
|
Reference in New Issue
Block a user