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

This commit is contained in:
2025-09-06 16:08:15 +08:00
commit 63285f61aa
2624 changed files with 88491 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
FROM debian:jessie
LABEL maintainer="https://github.com/helderco/"
# 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.3.29
##<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>##
# php 5.3 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 \
libxml2-dev \
xz-utils \
apache2-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.xz/from/this/mirror" -o php.tar.xz \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.xz -C /usr/src/php --strip-components=1 \
&& rm php.tar.xz* \
&& 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"]

View 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 "$@"

View 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 "$@"

View 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 "$@"

View 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

View File

@@ -0,0 +1,4 @@
# referer https://github.com/helderco/docker-php-5.3
FROM helder/php-5.3:latest
LABEL maintainer="root <root@leavesongs.com>"

View 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"]

View 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 "$@"

View 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 "$@"

View 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 "$@"

View 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

View 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"]

View 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 "$@"

View 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"]

View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php "$@"
fi
exec "$@"

View 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 "$@"

View 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

View File

@@ -0,0 +1,3 @@
FROM php:5.5-apache
LABEL maintainer="phithon <root@leavesongs.com>"

View File

@@ -0,0 +1,3 @@
FROM php:5.6-fpm
LABEL maintainer="phithon <root@leavesongs.com>"

View File

@@ -0,0 +1,9 @@
FROM php:5.6.23-fpm
LABEL maintainer="phithon <root@leavesongs.com>"
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends unzip git \
&& curl -sSL -o /usr/local/bin/composer https://github.com/composer/composer/releases/download/1.6.4/composer.phar \
&& chmod +x /usr/local/bin/composer

View File

@@ -0,0 +1,7 @@
FROM vulhub/php:5.6.23-fpm
LABEL phith0n="root <root@leavesongs.com>"
RUN set -ex \
&& cd /var/www/html \
&& composer require guzzlehttp/guzzle 6.2.0

View File

@@ -0,0 +1,13 @@
FROM php:5.6.38-apache
LABEL maintainer="phithon <root@leavesongs.com>"
ARG MIRROR_URL=https://github.com/vulhub/mirrors/raw/master/debian/stretch/aliyun.list
RUN set -ex \
&& curl -sL $MIRROR_URL -o /etc/apt/sources.list \
&& apt-get update \
&& apt-get install --no-install-recommends -y libc-client-dev libkrb5-dev ssh-client \
&& docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap \
&& rm -r /var/lib/apt/lists/*

View File

@@ -0,0 +1,79 @@
FROM debian:stretch
LABEL maintainer="phithon <root@leavesongs.com>"
ENV PHP_INI_DIR /usr/local/etc/php
RUN set -ex \
&& mkdir -p $PHP_INI_DIR/conf.d \
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c \
bison \
\
libcurl4-openssl-dev \
libedit-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
\
curl \
\
&& 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 \
&& cd /usr/src && rm -rf /tmp/libxml \
\
&& curl -#SL http://php.net/get/php-7.0.30.tar.gz/from/this/mirror | tar xz --strip-components=1 \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
&& ./configure --build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
--enable-option-checking=fatal \
--with-mhash \
--enable-ftp \
--enable-mbstring \
--enable-mysqlnd \
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
--disable-cgi \
&& make -j "$(nproc)" \
&& make install \
&& find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true \
&& make clean \
&& cd / \
&& apt-mark auto '.*' > /dev/null \
&& [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark \
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
\
&& php --version \
&& rm -rf /usr/src/* \
&& mkdir -p /var/www/html
WORKDIR /var/www/html
CMD ["php", "-S", "0.0.0.0:80", "-t", "/var/www/html"]

View File

@@ -0,0 +1,18 @@
FROM php:7.1-apache
LABEL maintainer="phithon <root@leavesongs.com>"
RUN set -ex \
&& pecl install xdebug-2.5.5 \
&& docker-php-ext-enable xdebug
RUN set -ex \
&& { \
echo "xdebug.remote_enable = 1"; \
echo "xdebug.remote_connect_back = 1"; \
echo "xdebug.remote_log = /tmp/xdebug.log"; \
} >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "date.timezone = \"UTC\"" >> /usr/local/etc/php/conf.d/timezone.ini \
&& a2enmod rewrite
EXPOSE 80

View File

@@ -0,0 +1,18 @@
FROM php:7.4-apache
LABEL maintainer="phithon <root@leavesongs.com>"
RUN set -ex \
&& pecl install xdebug-3.1.6 \
&& docker-php-ext-enable xdebug
RUN set -ex \
&& { \
echo "xdebug.mode = debug"; \
echo "xdebug.discover_client_host = 1"; \
echo "xdebug.log = /tmp/xdebug.log"; \
} >> /usr/local/etc/php/conf.d/xdebug.ini \
&& echo "date.timezone = \"UTC\"" >> /usr/local/etc/php/conf.d/timezone.ini \
&& a2enmod rewrite
EXPOSE 80

View File

@@ -0,0 +1,109 @@
FROM debian:buster
LABEL maintainer="phithon <root@leavesongs.com>"
ENV PHP_INI_DIR /usr/local/etc/php
ENV PHPIZE_DEPS \
autoconf \
dpkg-dev \
file \
g++ \
gcc \
libc-dev \
make \
pkg-config \
re2c \
bison
ARG PHP_URL="https://github.com/php/php-src/archive/c730aa26bd52829a49f2ad284b181b7e82a68d7d.tar.gz"
RUN set -eux \
&& mkdir -p $PHP_INI_DIR/conf.d \
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
${PHPIZE_DEPS} \
\
ca-certificates \
curl \
wget \
libargon2-dev \
libcurl4-openssl-dev \
libedit-dev \
libonig-dev \
libsodium-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
zlib1g-dev \
\
&& mkdir -p /usr/src \
&& cd /usr/src \
&& curl -#SL ${PHP_URL} | tar xz --strip-components=1 \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
&& if [ ! -d /usr/include/curl ]; then \
ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \
fi \
&& ./buildconf \
&& ./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
\
# make sure invalid --configure-flags are fatal errors instead of just warnings
--enable-option-checking=fatal \
\
# https://github.com/docker-library/php/issues/439
--with-mhash \
\
# https://github.com/docker-library/php/issues/822
--with-pic \
\
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
--enable-ftp \
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
--enable-mbstring \
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
--enable-mysqlnd \
# https://wiki.php.net/rfc/argon2_password_hash (7.2+)
\
--with-password-argon2 \
# https://wiki.php.net/rfc/libsodium
--with-sodium=shared \
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
--with-pdo-sqlite=/usr \
--with-sqlite3=/usr \
\
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
\
# bundled pcre does not support JIT on s390x
# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT
$(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \
--with-libdir="lib/$debMultiarch" \
&& make -j "$(nproc)" \
&& make install \
&& find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true \
&& make clean \
&& cd / \
&& apt-mark auto '.*' > /dev/null \
&& [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark \
&& find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
\
&& php --version \
&& rm -rf /usr/src/* \
&& mkdir -p /var/www/html
WORKDIR /var/www/html
CMD ["php", "-S", "0.0.0.0:80", "-t", "/var/www/html"]

View File

@@ -0,0 +1,3 @@
FROM php:8.3.4-apache
LABEL maintainer="phithon <root@leavesongs.com>"