├── apache
├── conf-enabled
│ └── phpfarm.conf
├── conf.d
│ └── phpfarm.conf
└── sites-available
│ ├── php-5.1.conf
│ ├── php-5.2.conf
│ ├── php-5.3.conf
│ ├── php-5.4.conf
│ ├── php-5.5.conf
│ ├── php-5.6.conf
│ ├── php-7.0.conf
│ ├── php-7.1.conf
│ ├── php-7.2.conf
│ ├── php-7.3.conf
│ ├── php-7.4.conf
│ ├── php-8.0.conf
│ └── php-x.x.conf
├── phpfarm
├── custom
│ ├── php.ini
│ ├── patches-5.1.6
│ │ ├── configure.in.patch
│ │ ├── README.md
│ │ ├── mysqli.patch
│ │ ├── imap.patch
│ │ ├── curl.patch
│ │ ├── openssl.patch
│ │ ├── run-tests.patch
│ │ ├── cgi.patch
│ │ ├── configure.patch
│ │ ├── mysqli-2.patch
│ │ └── pdo_oci.patch
│ ├── options-5.2.17.sh
│ ├── options.sh
│ ├── options-5.1.6.sh
│ └── post-install-5.1.6.sh
├── xdebug.ini
├── phpdl.sh
└── docker.sh
├── var-www
└── index.php
├── run.sh
├── license.txt
├── .circleci
└── config.yml
├── extensions.php
├── test.sh
├── Dockerfile-Wheezy
├── Dockerfile-Jessie
└── README.md
/apache/conf-enabled/phpfarm.conf:
--------------------------------------------------------------------------------
1 | # this is for jessie, it loads our wheezy located file
2 | Include conf.d/phpfarm.conf
3 |
--------------------------------------------------------------------------------
/apache/conf.d/phpfarm.conf:
--------------------------------------------------------------------------------
1 | # general config for the phpfarm setup
2 |
3 | # global FCGI config
4 | FcgidFixPathinfo 1
5 |
6 |
--------------------------------------------------------------------------------
/phpfarm/custom/php.ini:
--------------------------------------------------------------------------------
1 | ; custom ini settings, appended to the default php.ini
2 |
3 | cgi.fix_pathinfo = 1
4 | date.timezone = Europe/Berlin
5 | error_log = syslog
6 | extension_dir="$ext_dir"
7 | include_path=".:$install_dir/pear/php/"
8 |
9 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/configure.in.patch:
--------------------------------------------------------------------------------
1 | --- configure.in
2 | +++ configure.in
3 | @@ -1253,7 +1253,7 @@
4 |
5 | case $PHP_SAPI in
6 | cgi)
7 | - install_targets="install-sapi $install_targets $PHP_INSTALL_CLI_TARGET"
8 | + install_targets="install-sapi $install_targets"
9 | ;;
10 | cli)
11 | install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
12 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/README.md:
--------------------------------------------------------------------------------
1 | # PHP 5.1.6 patches
2 |
3 | Patches for PHP 5.1.6 source for it to compile on Debian Wheezy.
4 |
5 | Useful references:
6 | * Some ext patches: https://gist.github.com/0livier/4079937
7 | * Some ext patches (similar to above): http://yet.another.linux-nerd.com/blog/retro-php-compiling-5-dot-1-6-on-recent-linux/
8 | * Handling MySQLi ext: http://gunner.me/archives/403
9 |
10 |
--------------------------------------------------------------------------------
/phpfarm/custom/options-5.2.17.sh:
--------------------------------------------------------------------------------
1 | # custom options file for phpfarm
2 | # Applies the patch for https://bugs.php.net/bug.php?id=54736 when building PHP 5.2.17
3 |
4 | curl 'https://bugs.php.net/patch-display.php?bug_id=54736&patch=debian_patches_disable_SSLv2_for_openssl_1_0_0.patch&revision=1305414559&download=1' | patch $srcdir/ext/openssl/xp_ssl.c
5 |
6 | # no intl on 5.2
7 | configoptions=`echo "$configoptions" |sed 's/--enable-intl//'`
8 | configoptions="$configoptions --enable-fastcgi"
9 |
10 | echo "--- loaded custom/options-5.2.17.sh ---"
11 | echo $configoptions
12 | echo "---------------------------------------"
13 |
--------------------------------------------------------------------------------
/phpfarm/xdebug.ini:
--------------------------------------------------------------------------------
1 | ; xdebug debugging on demand
2 | xdebug.remote_enable = 1
3 | xdebug.remote_connect_back = 1
4 |
5 | ; xdebug profiling on demand
6 | xdebug.profiler_enable_trigger = 1
7 | xdebug.profiler_output_dir = /var/www/
8 | xdebug.profiler_output_name = xdebug.profile.%t.%R
9 |
10 | ; xdebug tracing on demand
11 | xdebug.trace_enable_trigger = 1
12 | xdebug.trace_output_dir = /var/www/
13 | xdebug.trace_output_name = xdebug.trace.%t.%R
14 | xdebug.trace_format = 1
15 |
16 | ; collect more data
17 | xdebug.show_mem_delta = 1
18 | xdebug.collect_params = 4
19 | xdebug.collect_return = 1
20 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.1.conf:
--------------------------------------------------------------------------------
1 | Listen 8051
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.1/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.2.conf:
--------------------------------------------------------------------------------
1 | Listen 8052
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.2/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.3.conf:
--------------------------------------------------------------------------------
1 | Listen 8053
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.3/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.4.conf:
--------------------------------------------------------------------------------
1 | Listen 8054
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.4/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.5.conf:
--------------------------------------------------------------------------------
1 | Listen 8055
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.5/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-5.6.conf:
--------------------------------------------------------------------------------
1 | Listen 8056
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-5.6/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-7.0.conf:
--------------------------------------------------------------------------------
1 | Listen 8070
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-7.0/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-7.1.conf:
--------------------------------------------------------------------------------
1 | Listen 8071
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-7.1/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-7.2.conf:
--------------------------------------------------------------------------------
1 | Listen 8072
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-7.2/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-7.3.conf:
--------------------------------------------------------------------------------
1 | Listen 8073
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-7.3/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-7.4.conf:
--------------------------------------------------------------------------------
1 | Listen 8074
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-7.4/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-8.0.conf:
--------------------------------------------------------------------------------
1 | Listen 8080
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-8.0/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/apache/sites-available/php-x.x.conf:
--------------------------------------------------------------------------------
1 | Listen 8000
2 |
3 | ServerAdmin webmaster@localhost
4 |
5 | DocumentRoot /var/www
6 |
7 | Options +FollowSymLinks
8 | AllowOverride None
9 |
10 |
11 | Options +FollowSymLinks +ExecCGI
12 | AllowOverride All
13 | Order allow,deny
14 | allow from all
15 |
16 |
17 |
18 | FCGIWrapper /phpfarm/inst/php-x.x/bin/php-cgi .php
19 | AddHandler fcgid-script .php
20 |
21 | LogLevel warn
22 | ErrorLog ${APACHE_LOG_DIR}/error.log
23 | CustomLog ${APACHE_LOG_DIR}/access.log combined
24 |
25 |
--------------------------------------------------------------------------------
/var-www/index.php:
--------------------------------------------------------------------------------
1 | > /etc/apache2/envvars
11 | chown -R wwwrun /var/lib/apache2
12 | fi
13 |
14 | # Get value of APACHE_LOG_DIR.
15 | . /etc/apache2/envvars
16 |
17 | # Direct logs to stdout/stderr so they will show in 'docker logs' command.
18 | ln -sf /dev/stderr $APACHE_LOG_DIR/error.log
19 | ln -sf /dev/stdout $APACHE_LOG_DIR/access.log
20 | ln -sf /dev/stdout $APACHE_LOG_DIR/other_vhosts_access.log
21 |
22 | # Apache gets grumpy about PID files pre-existing
23 | rm -f /var/run/apache2/apache2.pid
24 |
25 | # Start Apache in the foreground - Docker needs this to keep the container
26 | # running.
27 | apache2ctl -DFOREGROUND
28 |
29 | # No need to tail as Apache log files link to stdout/stderr now.
30 | # tail -f /var/log/apache2/error.log
31 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright (c) 2014-2016 Andreas Gohr http://www.splitbrain.org/blog/2014-02/02-docker_phpfarm
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/cgi.patch:
--------------------------------------------------------------------------------
1 | --- sapi/cgi/config9.m4
2 | +++ sapi/cgi/config9.m4
3 | @@ -88,10 +88,10 @@
4 | PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/cgi/Makefile.frag)
5 | case $host_alias in
6 | *cygwin* )
7 | - SAPI_CGI_PATH=sapi/cgi/php.exe
8 | + SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
9 | ;;
10 | * )
11 | - SAPI_CGI_PATH=sapi/cgi/php
12 | + SAPI_CGI_PATH=sapi/cgi/php-cgi
13 | ;;
14 | esac
15 | PHP_SUBST(SAPI_CGI_PATH)
16 | @@ -145,7 +145,7 @@
17 | AC_DEFINE_UNQUOTED(PHP_FCGI_STATIC, $PHP_FCGI_STATIC, [ ])
18 | AC_MSG_RESULT($PHP_ENABLE_FASTCGI)
19 |
20 | - INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)\$(EXEEXT)"
21 | + INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
22 | PHP_SELECT_SAPI(cgi, program, $PHP_FCGI_FILES cgi_main.c getopt.c, , '$(SAPI_CGI_PATH)')
23 |
24 | case $host_alias in
25 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/configure.patch:
--------------------------------------------------------------------------------
1 | --- configure
2 | +++ configure
3 | @@ -11746,10 +11746,10 @@
4 |
5 | case $host_alias in
6 | *cygwin* )
7 | - SAPI_CGI_PATH=sapi/cgi/php.exe
8 | + SAPI_CGI_PATH=sapi/cgi/php-cgi.exe
9 | ;;
10 | * )
11 | - SAPI_CGI_PATH=sapi/cgi/php
12 | + SAPI_CGI_PATH=sapi/cgi/php-cgi
13 | ;;
14 | esac
15 |
16 | @@ -11881,7 +11881,7 @@
17 |
18 | echo "$ac_t""$PHP_ENABLE_FASTCGI" 1>&6
19 |
20 | - INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php\$(program_suffix)\$(EXEEXT)"
21 | + INSTALL_IT="@echo \"Installing PHP CGI into: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
22 |
23 | PHP_SAPI=cgi
24 |
25 | @@ -112246,7 +112246,7 @@
26 |
27 | case $PHP_SAPI in
28 | cgi)
29 | - install_targets="install-sapi $install_targets"
30 | + install_targets="install-sapi $PHP_INSTALL_CLI_TARGET $install_targets"
31 | ;;
32 | cli)
33 | install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
34 |
--------------------------------------------------------------------------------
/phpfarm/custom/options.sh:
--------------------------------------------------------------------------------
1 | # we need the correct path, is there a better way to find it?
2 | if [ -d "/lib/i386-linux-gnu" ]; then
3 | LIBPATH="/lib/i386-linux-gnu/"
4 | else
5 | LIBPATH="/lib/x86_64-linux-gnu/"
6 |
7 | # fix problem with imap http://bit.ly/1WZcTWD
8 | ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
9 | fi
10 |
11 |
12 | configoptions="$configoptions \
13 | --enable-gd-native-ttf \
14 | --enable-intl \
15 | --with-ldap \
16 | --with-ldap-sasl \
17 | --with-bz2 \
18 | --with-config-file-scan-dir=/var/www/.php \
19 | --with-curl \
20 | --with-imap \
21 | --with-imap-ssl \
22 | --with-gd \
23 | --with-jpeg-dir=/usr/lib \
24 | --with-kerberos \
25 | --with-libdir=$LIBPATH \
26 | --with-mcrypt \
27 | --with-mhash \
28 | --with-mysql=/usr \
29 | --with-mysqli=/usr/bin/mysql_config \
30 | --with-openssl \
31 | --with-pdo-mysql \
32 | --with-pdo-pgsql \
33 | --with-png-dir=/usr/lib \
34 | --with-pgsql \
35 | --with-xsl=/usr \
36 | --with-freetype-dir=/usr/include/freetype2/ \
37 | "
38 |
39 | echo "--- loaded custom/options.sh ----------"
40 | echo $configoptions
41 | echo "---------------------------------------"
42 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/mysqli-2.patch:
--------------------------------------------------------------------------------
1 | --- ext/mysqli/mysqli_api.c
2 | +++ ext/mysqli/mysqli_api.c
3 | @@ -142,13 +142,13 @@
4 | switch (types[ofs]) {
5 | case 'd': /* Double */
6 | bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
7 | - bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
8 | + bind[ofs].buffer = (char*)&Z_DVAL_PP(args[i]);
9 | bind[ofs].is_null = &stmt->param.is_null[ofs];
10 | break;
11 |
12 | case 'i': /* Integer */
13 | bind[ofs].buffer_type = MYSQL_TYPE_LONG;
14 | - bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
15 | + bind[ofs].buffer = (char*)&Z_LVAL_PP(args[i]);
16 | bind[ofs].is_null = &stmt->param.is_null[ofs];
17 | break;
18 |
19 | @@ -598,11 +598,11 @@
20 | break;
21 | case MYSQL_TYPE_DOUBLE:
22 | convert_to_double_ex(&stmt->param.vars[i]);
23 | - stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
24 | + stmt->stmt->params[i].buffer = (char*)&Z_LVAL_PP(&stmt->param.vars[i]);
25 | break;
26 | case MYSQL_TYPE_LONG:
27 | convert_to_long_ex(&stmt->param.vars[i]);
28 | - stmt->stmt->params[i].buffer = (gptr)&Z_LVAL_PP(&stmt->param.vars[i]);
29 | + stmt->stmt->params[i].buffer = (char*)&Z_LVAL_PP(&stmt->param.vars[i]);
30 | break;
31 | default:
32 | break;
33 |
--------------------------------------------------------------------------------
/phpfarm/phpdl.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | VERSION=$1
4 | DIR=$2
5 | OUT="$DIR/php-$VERSION.tar.bz2"
6 | EXT="$DIR/../php-$VERSION"
7 |
8 | # print a message to STDERR and die
9 | die() {
10 | echo $1 >&2
11 | exit 1
12 | }
13 |
14 | # check parameters
15 | [ -z "$VERSION" ] && die "no version given"
16 | [ -z "$DIR" ] && die "no output directory given"
17 |
18 | # create output directory
19 | if [ ! -d "$DIR" ]; then
20 | mkdir -p "$DIR" || die "failed to create output directory"
21 | fi
22 | if [ ! -d "$EXT" ]; then
23 | mkdir -p "$EXT" || die "failed to create extraction directory"
24 | fi
25 |
26 | # construct URL
27 | if [[ $VERSION == *"RC"* ]]; then
28 | URL="https://downloads.php.net/~pollita/php-$VERSION.tar.bz2"
29 | elif [[ $VERSION == "x.x.x" ]]; then
30 | URL="https://github.com/php/php-src/tarball/master"
31 | OUT="$DIR/php-$VERSION.tar.gz"
32 | elif [ $VERSION \< "5.6" ]; then
33 | URL="http://museum.php.net/php5/php-$VERSION.tar.bz2"
34 | else
35 | URL="http://php.net/get/php-$VERSION.tar.bz2/from/this/mirror"
36 | fi
37 |
38 | # do nothing if file exists
39 | [ -f "$OUT" ] && exit 0
40 |
41 | # download
42 | echo "downloading $URL -> $OUT, extracting to $EXT"
43 | curl -L --silent --show-error --fail -o "$OUT" "$URL" && \
44 | tar -xvf "$OUT" -C "$EXT" --strip-components 1
45 | exit $?
46 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | # PHP CircleCI 2.0 configuration file
2 | #
3 | # Check https://circleci.com/docs/2.0/language-php/ for more details
4 | #
5 | version: 2
6 | jobs:
7 | build:
8 | docker:
9 | # Image for build runner.
10 | - image: docker:17.06
11 | steps:
12 | - checkout
13 | - setup_remote_docker
14 | - run:
15 | name: Setup build runner
16 | command: |
17 | # Packages needed for test scripts.
18 | apk --no-cache add bash php5
19 | ln -s /usr/bin/php5 /usr/bin/php
20 | # Needed to push built Docker images to registry.
21 | docker login -u $DOCKER_USER -p $DOCKER_PASS
22 | - run:
23 | name: 'Jessie: build'
24 | command: |
25 | # --squash not allowed as Docker daemon doesn't have experimental features.
26 | docker build -t splitbrain/phpfarm:jessie -t splitbrain/phpfarm:latest -f Dockerfile-Jessie .
27 | - run:
28 | name: 'Jessie: test and push'
29 | command: |
30 | # Do tests specially modified for CircleCI environment.
31 | ./test.sh jessie
32 | docker push splitbrain/phpfarm:jessie
33 | docker push splitbrain/phpfarm:latest
34 | - run:
35 | name: 'Wheezy: build'
36 | command: |
37 | # --squash not allowed as Docker daemon doesn't have experimental features.
38 | docker build -t splitbrain/phpfarm:wheezy -t splitbrain/phpfarm:latest -f Dockerfile-Wheezy .
39 | - run:
40 | name: 'Wheezy: test and push'
41 | command: |
42 | ./test.sh wheezy
43 | # Do tests specially modified for CircleCI environment.
44 | docker push splitbrain/phpfarm:wheezy
45 |
46 |
--------------------------------------------------------------------------------
/phpfarm/custom/options-5.1.6.sh:
--------------------------------------------------------------------------------
1 | # custom options file for phpfarm
2 |
3 |
4 | # Apply patches for building PHP 5.1.6
5 |
6 | patchDir='/phpfarm/src/custom/patches-5.1.6'
7 |
8 | # Patch extensions.
9 | patch -b -d $srcdir -p0 < $patchDir/curl.patch
10 | patch -b -d $srcdir -p0 < $patchDir/pdo_oci.patch
11 | patch -b -d $srcdir -p0 < $patchDir/imap.patch
12 |
13 | # Both CGI and CLI compile to 'php' which is incompatible with future versions.
14 | # See: http://php.net/manual/en/features.commandline.introduction.php
15 | # Patch CGI to make it build to 'php-cgi' instead of 'php'.
16 | patch -b -d $srcdir -p0 < $patchDir/cgi.patch
17 |
18 | # Another patch for CGI compile. And ensure that CLI is also compiled.
19 | # Otherwise will result in 'no php found' error in compile.sh.
20 | patch -b -d $srcdir -p0 < $patchDir/configure.patch
21 |
22 | # Not needed for compile as they are only Autoconf template files and tests.
23 | # patch -b -d $srcdir -p0 < $patchDir/configure.in.patch
24 | # patch -b -d $srcdir -p0 < $patchDir/run-tests.patch
25 |
26 | # no intl on 5.1.6
27 | configoptions=`echo "$configoptions" |sed 's/--enable-intl//'`
28 |
29 | # OpenSSL and MySQLi options result in unresolvable errors due to
30 | # incompatibilities with existing libraries - leave them out.
31 | # MySQLi extension can be compiled later using PHPize, see http://gunner.me/archives/403
32 | configoptions=`echo "$configoptions" |sed 's/--with-openssl//'`
33 | # Remove '--with-mysqli=/path/to/config'
34 | configoptions=`echo "$configoptions" |sed 's/--with-mysqli\(=[^ ]\+\)\?//'`
35 |
36 | # Required to build FastCGI interpreter.
37 | configoptions="$configoptions --enable-fastcgi"
38 |
39 |
40 | echo "--- loaded custom/options-5.1.6.sh ---"
41 | echo $configoptions
42 | echo "---------------------------------------"
43 |
--------------------------------------------------------------------------------
/extensions.php:
--------------------------------------------------------------------------------
1 | $port) {
13 | $mods = @file("http://localhost:$port/?modules");
14 | if(!$mods || substr(trim($mods[0]),0,1) == '<') {
15 | # not the response we're looking for
16 | unset($ports[$k]);
17 | continue;
18 | }
19 | foreach($mods as $mod) {
20 | $mod = trim($mod);
21 | if($mod == 'core') continue;
22 | $allmods[$mod][$port] = 1;
23 | }
24 | }
25 | $ports = array_values($ports);
26 | ksort($allmods);
27 |
28 | # Build table header:
29 | # Extension | PHP 5.1 | PHP 5.2 | ... | PHP 7.1
30 | print 'Extension ';
31 | foreach($ports as $port) {
32 | $major = substr($port,2,1);
33 | $minor = substr($port,3,1);
34 | if($major) {
35 | $version = "PHP $major.$minor";
36 | } else {
37 | $version = "nightly";
38 | }
39 |
40 | echo '| '.$version.' ';
41 | }
42 | echo "\n";
43 |
44 | #
45 | # Line below header.
46 | #
47 |
48 | # Right colon for right alignment.
49 | echo '------------:';
50 | foreach($ports as $port) {
51 | # Colons on both sides for centre alignment.
52 | echo '|:-------:';
53 | }
54 | echo "\n";
55 |
56 | #
57 | # Output modules table.
58 | #
59 | foreach($allmods as $mod => $inf) {
60 | # Left align mod name, and pad with spaces.
61 | printf('%-12s ', $mod);
62 | foreach($ports as $port) {
63 | if(isset($inf[$port])) {
64 | echo '| ✓ ';
65 | } else {
66 | echo '| ';
67 | }
68 | }
69 | echo "\n";
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/phpfarm/custom/post-install-5.1.6.sh:
--------------------------------------------------------------------------------
1 | #
2 | # Post-build and install script for PHP 5.1.6.
3 | #
4 |
5 | version='5.1.6'
6 | # PHP 5.1.6 sources.
7 | srcDir="/phpfarm/src/php-$version"
8 | # Installation dir.
9 | instDir="/phpfarm/inst/php-$version"
10 | # Bins for this PHP version.
11 | binDir="$instDir/bin"
12 |
13 |
14 | #
15 | # Extensions in php.ini.
16 | #
17 |
18 | # php.ini file for PHP version.
19 | phpIniFile=$instDir/etc/php.ini
20 |
21 | # Need to specify 'extension_dir', then 'extension' as filename without path.
22 | # As 'extension = /phpfarm/inst/php-5.1.6/lib/mysqli.so' doesn't work.
23 | echo "extension_dir = $instDir/lib" >> $phpIniFile
24 |
25 |
26 | #
27 | # MySQLi extension - compile and load.
28 | #
29 |
30 | # Dir where all patches are stored.
31 | patchDir="/phpfarm/src/custom/patches-$version"
32 |
33 | # Patch extension source before compiling.
34 | patch -d $srcDir -p0 < $patchDir/mysqli.patch
35 | patch -d $srcDir -p0 < $patchDir/mysqli-2.patch
36 |
37 | # Compile mysqli extension separately. Compiling the extension together with
38 | # PHP using --with-mysqli breaks. See http://gunner.me/archives/403
39 | cd $srcDir/ext/mysqli
40 | $binDir/phpize
41 | ./configure --with-php-config=$binDir/php-config --with-mysqli=/usr/bin/mysql_config
42 | make
43 |
44 | # Move compiled extension to extension dir.
45 | cp modules/mysqli.so $instDir/lib/
46 |
47 | # Load extension in php.ini.
48 | echo 'extension = mysqli.so' >> $phpIniFile
49 |
50 |
51 | #
52 | # OpenSSL extension - compile and load.
53 | #
54 |
55 | # Patch extension source before compiling.
56 | patch -d $srcDir -p0 < $patchDir/openssl.patch
57 |
58 | # Compile openssl extension separately. Compiling the extension together with
59 | # PHP using --with-openssl breaks.
60 | cd $srcDir/ext/openssl
61 | # PHPize needs to find config.m4 to start due to bug https://bugs.php.net/bug.php?id=53571
62 | cp config0.m4 config.m4
63 | $binDir/phpize
64 | ./configure --with-php-config=$binDir/php-config --with-openssl
65 | make
66 |
67 | # Move compiled extension to extension dir.
68 | cp modules/openssl.so $instDir/lib/
69 |
70 | # Load extension in php.ini.
71 | echo 'extension = openssl.so' >> $phpIniFile
72 |
73 |
--------------------------------------------------------------------------------
/test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Test the Docker image to see if it runs PHP successfully.
4 | # Usage: test.sh [tag]
5 | # Where tag is the image tag you want to test. Can be 'latest', 'jessie' or
6 | # 'wheezy'.
7 |
8 | # Name of Docker image to test.
9 | DOCKER_IMG=splitbrain/phpfarm
10 |
11 | # Tag of image to test e.g. 'latest', 'wheezy'.
12 | TAG=$1
13 |
14 |
15 | if [ -z "$TAG" ]; then
16 | TAG=jessie
17 | fi
18 |
19 | # Ports to test for.
20 | if [ "$TAG" = jessie ]; then
21 | # Debian:Jessie supports PHP 5.3 and above only.
22 | ports='8053 8054 8055 8056 8070 8071 8072 8073 8074 8080 8000'
23 | else
24 | # Debian:Wheezy supports all versions til 7.2, no nightlies
25 | ports='8051 8052 8053 8054 8055 8056 8070 8071 8072'
26 | fi
27 |
28 | # Create the docker run option for publishing ports.
29 | # E.g. -p 8051:8051 -p 8052:8052 ...
30 | publishOption=''
31 | for port in $ports; do
32 | publishOption="$publishOption -p ${port}:${port}"
33 | done
34 |
35 | container=$( docker run -d $publishOption $DOCKER_IMG:$TAG )
36 |
37 | if [ -z "$container" ]; then
38 | echo -e "\e[31mFailed to start container\e[0m"
39 | exit 1
40 | else
41 | echo "$TAG container $container started. Waiting to start up"
42 | fi
43 |
44 | # Wait for container to start.
45 | sleep 5s
46 |
47 | # Record results of the port test.
48 | portTestResult=0
49 |
50 | # Test if all required ports are showing a PHP version.
51 | for port in $ports; do
52 |
53 | if [ -z "$CIRCLECI" ]; then
54 | # Not in Circle CI, curl to localhost to access container directly.
55 | result=$(curl --silent http://localhost:$port/ | grep -Eo 'PHP Version [0-9]+\.[0-9]+\.[0-9]+')
56 | else
57 | # In CircleCI, cannot access container port via localhost.
58 | # Build runner and created Docker containers run in separate
59 | # environments. So scripts in build runner (the job) cannot
60 | # communicate with Docker services.
61 | result=$(docker exec $container curl --silent http://localhost:$port/ | grep -Eo 'PHP Version [0-9]+\.[0-9]+\.[0-9]+')
62 | fi
63 |
64 | if [ -z "$result" ]; then
65 | echo -e "Port $port: \e[31mFAILED\e[0m"
66 | # Set port test result to "error" (non-zero) if any port test fails.
67 | portTestResult=1
68 | else
69 | echo -e "Port $port: \e[32m$result\e[0m"
70 | fi
71 | done
72 |
73 | # Display status of PHP extensions.
74 | # extensions.php curls to localhost, which doesn't work in a CircleCI env
75 | # where we cannot access the created container directly.
76 | if [ -z "$CIRCLECI" ]; then
77 | echo -e 'Checking extensions...\n\n'
78 | php extensions.php
79 | fi
80 |
81 | docker kill $container
82 | docker rm $container
83 |
84 | # Return the port test result as representing the entire script's result.
85 | exit $portTestResult
86 |
87 |
--------------------------------------------------------------------------------
/phpfarm/docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # this script builds everything for docker
3 |
4 |
5 | if [ -z "$PHP_FARM_VERSIONS" ]; then
6 | echo "PHP versions not set! Aborting setup" >&2
7 | exit 1
8 | fi
9 |
10 | export $MAKE_OPTIONS="-j$(nproc)"
11 |
12 | # fix freetype for older php https://stackoverflow.com/a/26342869
13 | mkdir /usr/include/freetype2/freetype
14 | ln -s /usr/include/freetype2/freetype.h /usr/include/freetype2/freetype/freetype.h
15 |
16 | # build and symlink to major.minor
17 | for VERSION in $PHP_FARM_VERSIONS
18 | do
19 | cd /phpfarm/src # make absolutely sure we're in the correct directory
20 |
21 | echo "--- compiling version $VERSION -----------------------------------------"
22 | # download the bzip
23 | ./phpdl.sh $VERSION /phpfarm/src/bzips
24 |
25 | V=$(echo $VERSION | awk -F. '{print $1"."$2}')
26 |
27 | # compile the PHP version
28 | ./compile.sh $VERSION
29 | ln -s "/phpfarm/inst/php-$VERSION/" "/phpfarm/inst/php-$V"
30 | ln -s "/phpfarm/inst/bin/php-$VERSION" "/phpfarm/inst/bin/php-$V"
31 | ln -s "/phpfarm/inst/bin/php-cgi-$VERSION" "/phpfarm/inst/bin/php-cgi-$V"
32 | ln -s "/phpfarm/inst/bin/phpize-$VERSION" "/phpfarm/inst/bin/phpize-$V"
33 | ln -s "/phpfarm/inst/bin/php-config-$VERSION" "/phpfarm/inst/bin/php-config-$V"
34 |
35 | # compile xdebug
36 | if [ "$V" == "5.1" ] || [ "$V" == "5.2" ] || [ "$V" == "5.3" ]; then
37 | XDBGVERSION="XDEBUG_2_2_7" # old release for old PHP versions
38 | elif [ "$V" == "5.4" ]; then
39 | XDBGVERSION="XDEBUG_2_4_1" # old release for old PHP versions
40 | elif [[ $VERSION == *"RC"* ]]; then
41 | XDBGVERSION="master" # master for RCs
42 | elif [ "$V" == "5.5" ] || [ "$V" == "5.6" ]; then
43 | XDBGVERSION="XDEBUG_2_5_5" # 2.5.X release for PHP 5.5 and 5.6
44 | elif [ "$V" == "7.0" ] || [ "$V" == "7.1" ] || [ "$V" == "7.2" ]; then
45 | XDBGVERSION="2.6.0" # 2.6.X release for PHP 7.0 - 7.2
46 | elif [ "$V" == "7.3" ] || [ "$V" == "7.4" ]; then
47 | XDBGVERSION="2.9.8" # 7.3 and 7.4
48 | else
49 | XDBGVERSION="3.0.1" # 8.0+
50 | fi
51 |
52 | echo "--- compiling xdebug $XDBGVERSION for php $V ---------------------"
53 |
54 | wget https://github.com/xdebug/xdebug/archive/$XDBGVERSION.tar.gz && \
55 | tar -xzvf $XDBGVERSION.tar.gz && \
56 | cd xdebug-$XDBGVERSION && \
57 | phpize-$V && \
58 | ./configure --enable-xdebug --with-php-config=/phpfarm/inst/bin/php-config-$V && \
59 | make $MAKE_OPTIONS && \
60 | cp -v modules/xdebug.so /phpfarm/inst/php-$V/lib/ && \
61 | echo "zend_extension_debug = /phpfarm/inst/php-$V/lib/xdebug.so" >> /phpfarm/inst/php-$V/etc/php.ini && \
62 | echo "zend_extension = /phpfarm/inst/php-$V/lib/xdebug.so" >> /phpfarm/inst/php-$V/etc/php.ini && \
63 | cd .. && \
64 | rm -rf xdebug-$XDBGVERSION && \
65 | rm -f $XDBGVERSION.tar.gz && \
66 | cat xdebug.ini >> /phpfarm/inst/php-$V/etc/php.ini
67 |
68 | # enable apache config - compatible with wheezy and jessie
69 | a2ensite php-$V.conf
70 | done
71 |
72 | # print what have installed
73 | ls -l /phpfarm/inst/bin/
74 |
75 | # enable rewriting
76 | a2enmod rewrite
77 |
78 | # remove defaults
79 | a2dissite 000-default
80 | echo > /etc/apache2/ports.conf
81 |
82 | # clean up sources
83 | rm -rf /phpfarm/src
84 | apt-get clean
85 | rm -rf /var/lib/apt/lists/*
86 |
--------------------------------------------------------------------------------
/Dockerfile-Wheezy:
--------------------------------------------------------------------------------
1 | #
2 | # PHP Farm Docker image
3 | #
4 |
5 | # we use Debian as the host OS
6 | FROM philcryer/min-wheezy:latest
7 |
8 | LABEL author="Andreas Gohr , Eugene Sia "
9 |
10 | ENV \
11 | # Packages needed for running various build scripts.
12 | SCRIPT_PKGS=" \
13 | debian-keyring \
14 | wget \
15 | " \
16 | # Packages only needed for PHP build.
17 | BUILD_PKGS=" \
18 | autoconf \
19 | build-essential \
20 | # Flex needed for PHP 5.1 & 5.2 see http://php.net/manual/en/install.unix.php
21 | flex \
22 | lemon \
23 | pkg-config \
24 | " \
25 | # PHP runtime dependencies.
26 | RUNTIME_PKGS=" \
27 | # Needed for PHP and Git to connect with SSL sites.
28 | ca-certificates \
29 | curl \
30 | # apt-get complains that this is an 'essential' package.
31 | debian-archive-keyring \
32 | imagemagick \
33 | libbz2-dev \
34 | libc-client2007e-dev \
35 | libcurl4-openssl-dev \
36 | libfreetype6-dev \
37 | libicu-dev \
38 | libjpeg-dev \
39 | libldap2-dev \
40 | libltdl-dev \
41 | libmcrypt-dev \
42 | libmhash-dev \
43 | libmysqlclient-dev \
44 | libpng-dev \
45 | libpq-dev \
46 | libsasl2-dev \
47 | libssl-dev \
48 | libsslcommon2-dev \
49 | libt1-dev \
50 | libwebp-dev \
51 | libxml2-dev \
52 | libxpm-dev \
53 | libxslt1-dev \
54 | " \
55 | # Packages needed to run Apache httpd.
56 | APACHE_PKGS="\
57 | apache2 \
58 | apache2-mpm-prefork \
59 | # Fcgid mod for Apache - not a build dependency library.
60 | libapache2-mod-fcgid \
61 | "
62 |
63 | # Install Apache and packages we need for runtime usage.
64 | RUN apt-get update && \
65 | apt-get install -y --no-install-recommends \
66 | $RUNTIME_PKGS \
67 | $APACHE_PKGS && \
68 | \
69 | # Clean up apt package lists.
70 | rm -rf /var/lib/apt/lists/*
71 |
72 |
73 | # Reconfigure Apache
74 | RUN rm -rf /var/www/*
75 | # Import our Apache configs.
76 | COPY var-www /var/www/
77 | COPY apache /etc/apache2/
78 |
79 |
80 | # Import our own modifications for the PhpFarm script.
81 | COPY phpfarm /phpfarm_mod
82 |
83 | # The PHP versions to compile.
84 | ENV PHP_FARM_VERSIONS="5.1.6 5.2.17 5.3.29 5.4.45 5.5.38 5.6.32 7.0.28 7.1.15 7.2.3" \
85 | \
86 | # Flags for C Compiler Loader: make php 5.3 work again.
87 | LDFLAGS="-lssl -lcrypto -lstdc++" \
88 | \
89 | # Add path to built PHP executables, for module building and for Apache.
90 | PATH="/phpfarm/inst/bin/:$PATH"
91 |
92 |
93 | # Install packages needed for build.
94 | RUN apt-get update && \
95 | apt-get install -y --no-install-recommends $SCRIPT_PKGS $BUILD_PKGS && \
96 | \
97 | # Download PhpFarm scripts into /phpfarm/.
98 | wget -O /phpfarm.tar.gz https://github.com/fpoirotte/phpfarm/archive/v0.2.0.tar.gz && \
99 | mkdir /phpfarm && \
100 | tar -xf /phpfarm.tar.gz -C /phpfarm --strip 1 && \
101 | #
102 | # Overwrite PhpFarm with our own modifications.
103 | rm -rf /phpfarm/src/bzips /phpfarm/src/custom && \
104 | mv /phpfarm_mod/* /phpfarm/src/ && \
105 | #
106 | # Wait for docker.sh to finish moving else trying to exec a file being
107 | # written will output "Text file busy" error.
108 | sleep 5s && \
109 | rmdir /phpfarm_mod && \
110 | #
111 | # Build all PHP versions.
112 | cd /phpfarm/src && \
113 | ./docker.sh && \
114 | #
115 | # Clean up.
116 | apt-get purge -y $SCRIPT_PKGS $BUILD_PKGS && \
117 | apt-get autoremove -y && \
118 | rm -rf /var/lib/apt/lists/*
119 |
120 |
121 | # expose the ports
122 | EXPOSE 8000 8051 8052 8053 8054 8055 8056 8070 8071 8072
123 |
124 | # run it
125 | WORKDIR /var/www
126 | COPY run.sh /run.sh
127 | CMD ["/bin/bash", "/run.sh"]
128 |
129 |
--------------------------------------------------------------------------------
/Dockerfile-Jessie:
--------------------------------------------------------------------------------
1 | #
2 | # PHP Farm Docker image
3 | #
4 |
5 | # we use Debian as the host OS
6 | FROM philcryer/min-jessie:latest
7 |
8 | LABEL author="Andreas Gohr , Eugene Sia "
9 |
10 | ENV \
11 | # Packages needed for running various build scripts.
12 | SCRIPT_PKGS=" \
13 | debian-keyring \
14 | wget \
15 | " \
16 | # Packages only needed for PHP build.
17 | BUILD_PKGS=" \
18 | autoconf \
19 | build-essential \
20 | # Flex needed for PHP 5.1 & 5.2 see http://php.net/manual/en/install.unix.php
21 | flex \
22 | lemon \
23 | bison \
24 | pkg-config \
25 | re2c \
26 | " \
27 | # PHP runtime dependencies.
28 | RUNTIME_PKGS=" \
29 | # Needed for PHP and Git to connect with SSL sites.
30 | ca-certificates \
31 | curl \
32 | # apt-get complains that this is an 'essential' package.
33 | debian-archive-keyring \
34 | imagemagick \
35 | libbz2-dev \
36 | libc-client2007e-dev \
37 | libcurl4-openssl-dev \
38 | libfreetype6-dev \
39 | libicu-dev \
40 | libjpeg-dev \
41 | libkrb5-dev \
42 | libldap2-dev \
43 | libltdl-dev \
44 | libmcrypt-dev \
45 | libmhash-dev \
46 | libmysqlclient-dev \
47 | libonig-dev \
48 | libpng-dev \
49 | libpq-dev \
50 | libsasl2-dev \
51 | libsqlite3-dev \
52 | libssl-dev \
53 | libwebp-dev \
54 | libxml2-dev \
55 | libxpm-dev \
56 | libxslt1-dev \
57 | libzip-dev \
58 | " \
59 | # Packages needed to run Apache httpd.
60 | APACHE_PKGS="\
61 | apache2 \
62 | apache2-mpm-prefork \
63 | # Fcgid mod for Apache - not a build dependency library.
64 | libapache2-mod-fcgid \
65 | "
66 |
67 | # Install packages we need for runtime usage.
68 | RUN apt-get update && \
69 | apt-get install -y --no-install-recommends \
70 | $RUNTIME_PKGS \
71 | $APACHE_PKGS && \
72 | \
73 | # Clean up apt package lists.
74 | rm -rf /var/lib/apt/lists/*
75 |
76 |
77 | # Reconfigure Apache
78 | RUN rm -rf /var/www/*
79 | # Import our Apache configs.
80 | COPY var-www /var/www/
81 | COPY apache /etc/apache2/
82 |
83 |
84 | # Import our own modifications for the PhpFarm script.
85 | COPY phpfarm /phpfarm_mod
86 |
87 | # The PHP versions to compile.
88 | ENV PHP_FARM_VERSIONS="5.3.29 5.4.45 5.5.38 5.6.39 7.0.33 7.1.25 7.2.34 7.3.25 7.4.13 8.0.0" \
89 | \
90 | # Flags for C Compiler Loader: make php 5.3 work again.
91 | LDFLAGS="-lssl -lcrypto -lstdc++" \
92 | \
93 | # Add path to built PHP executables, for module building and for Apache.
94 | PATH="/phpfarm/inst/bin/:$PATH"
95 |
96 |
97 | # Install packages needed for build.
98 | RUN apt-get update && \
99 | apt-get install -y --no-install-recommends $SCRIPT_PKGS $BUILD_PKGS && \
100 | \
101 | # Download PhpFarm scripts into /phpfarm/.
102 | wget -O /phpfarm.tar.gz https://github.com/fpoirotte/phpfarm/archive/v0.3.0.tar.gz && \
103 | mkdir /phpfarm && \
104 | tar -xf /phpfarm.tar.gz -C /phpfarm --strip 1 && \
105 | #
106 | # Overwrite PhpFarm with our own modifications.
107 | rm -rf /phpfarm/src/bzips /phpfarm/src/custom && \
108 | mv /phpfarm_mod/* /phpfarm/src/ && \
109 | #
110 | # Wait for docker.sh to finish moving else trying to exec a file being
111 | # written will output "Text file busy" error.
112 | sleep 5s && \
113 | rmdir /phpfarm_mod && \
114 | #
115 | # Build all PHP versions.
116 | cd /phpfarm/src && \
117 | ./docker.sh && \
118 | #
119 | # Clean up.
120 | apt-get purge -y $SCRIPT_PKGS $BUILD_PKGS && \
121 | apt-get autoremove -y && \
122 | rm -rf /var/lib/apt/lists/*
123 |
124 |
125 | # expose the ports
126 | EXPOSE 8053 8054 8055 8056 8070 8071 8072 8073 8074 8080
127 |
128 | # run it
129 | WORKDIR /var/www
130 | COPY run.sh /run.sh
131 | CMD ["/bin/bash", "/run.sh"]
132 |
133 |
--------------------------------------------------------------------------------
/phpfarm/custom/patches-5.1.6/pdo_oci.patch:
--------------------------------------------------------------------------------
1 | --- ext/pdo_oci/config.m4
2 | +++ ext/pdo_oci/config.m4
3 | @@ -1,35 +1,24 @@
4 | -dnl $Id: config.m4,v 1.14.2.5 2006/02/16 02:03:13 pollita Exp $
5 | -
6 | -if test "$PHP_PDO" != "no"; then
7 | +dnl $Id$
8 | +dnl config.m4 for extension pdo_oci
9 | +dnl vim:et:sw=2:ts=2:
10 |
11 | +SUPPORTED_LIB_VERS="9.0 10.1 11.1" # This caters for all Oracle 9.x, 10.x and 11.1 installs
12 | AC_DEFUN([AC_PDO_OCI_VERSION],[
13 | AC_MSG_CHECKING([Oracle version])
14 | - if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then
15 | - PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
16 | - test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
17 | - elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
18 | - PDO_OCI_VERSION=10.1
19 | - elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
20 | - PDO_OCI_VERSION=9.0
21 | - elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
22 | - PDO_OCI_VERSION=8.1
23 | - elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
24 | - PDO_OCI_VERSION=8.0
25 | - elif test -f $PDO_OCI_LIB_DIR/libclntsh.a; then
26 | - if test -f $PDO_OCI_LIB_DIR/libcore4.a; then
27 | - PDO_OCI_VERSION=8.0
28 | - else
29 | - PDO_OCI_VERSION=8.1
30 | - fi
31 | - else
32 | - AC_MSG_ERROR(Oracle-OCI needed libraries not found under $PDO_OCI_DIR)
33 | + for OCI_VER in $SUPPORTED_LIB_VERS; do
34 | + if test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.$OCI_VER; then
35 | + PDO_OCI_VERSION="$OCI_VER"
36 | + fi
37 | + done
38 | + if test -z "$PDO_OCI_VERSION"; then
39 | + AC_MSG_ERROR([Oracle required OCI8 libraries not found under $PDO_OCI_DIR])
40 | fi
41 | AC_MSG_RESULT($PDO_OCI_VERSION)
42 | ])
43 |
44 | AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
45 | AC_CHECK_SIZEOF(long int, 4)
46 | - AC_MSG_CHECKING([checking if we're at 64-bit platform])
47 | + AC_MSG_CHECKING([if we're on a 64-bit platform])
48 | if test "$ac_cv_sizeof_long_int" = "4" ; then
49 | AC_MSG_RESULT([no])
50 | TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
51 | @@ -39,74 +28,95 @@
52 | fi
53 |
54 | AC_MSG_CHECKING([OCI8 libraries dir])
55 | - if test -d "$PDO_OCI_DIR/lib" -a ! -d "$PDO_OCI_DIR/lib32"; then
56 | + if test -d "$PDO_OCI_DIR/lib" && test ! -d "$PDO_OCI_DIR/lib32"; then
57 | PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib"
58 | - elif ! test -d "$PDO_OCI_DIR/lib" -a -d "$PDO_OCI_DIR/lib32"; then
59 | + elif test ! -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
60 | PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
61 | - elif test -d "$PDO_OCI_DIR/lib" -a -d "$PDO_OCI_DIR/lib32"; then
62 | + elif test -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
63 | PDO_OCI_LIB_DIR=$TMP_PDO_OCI_LIB_DIR
64 | else
65 | - AC_MSG_ERROR([Oracle (OCI8) required libraries not found])
66 | + AC_MSG_ERROR([Oracle required OCI8 libraries not found])
67 | fi
68 | AC_MSG_RESULT($PDO_OCI_LIB_DIR)
69 | ])
70 |
71 | PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO,
72 | -[ --with-pdo-oci[=DIR] PDO: Oracle-OCI support. Default DIR is ORACLE_HOME.
73 | - You may also use --with-pdo-oci=instantclient,prefix,version to use
74 | - the InstantClient SDK. For Linux with 10.1.0.3 rpms (for example) use:
75 | - --with-pdo-oci=instantclient,/usr,10.1.0.3])
76 | +[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME.
77 | + Use --with-pdo-oci=instantclient,prefix,version
78 | + for an Oracle Instant Client SDK.
79 | + For example on Linux with 11.2 RPMs use:
80 | + --with-pdo-oci=instantclient,/usr,11.2
81 | + With 10.2 RPMs use:
82 | + --with-pdo-oci=instantclient,/usr,10.2.0.4])
83 |
84 | if test "$PHP_PDO_OCI" != "no"; then
85 | +
86 | + if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
87 | + AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
88 | + fi
89 | +
90 | AC_MSG_CHECKING([Oracle Install-Dir])
91 | if test "$PHP_PDO_OCI" = "yes" || test -z "$PHP_PDO_OCI"; then
92 | PDO_OCI_DIR=$ORACLE_HOME
93 | else
94 | PDO_OCI_DIR=$PHP_PDO_OCI
95 | fi
96 | - AC_MSG_RESULT($PDO_OCI_DIR :$PHP_PDO_OCI:)
97 | + AC_MSG_RESULT($PHP_PDO_OCI)
98 |
99 | AC_MSG_CHECKING([if that is sane])
100 | if test -z "$PDO_OCI_DIR"; then
101 | AC_MSG_ERROR([
102 | -You need to tell me where to find your oracle SDK, or set ORACLE_HOME.
103 | +You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.
104 | ])
105 | else
106 | AC_MSG_RESULT([yes])
107 | fi
108 |
109 | - AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)
110 | -
111 | if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then
112 | + AC_CHECK_SIZEOF(long int, 4)
113 | + if test "$ac_cv_sizeof_long_int" = "4" ; then
114 | + PDO_OCI_CLIENT_DIR="client"
115 | + else
116 | + PDO_OCI_CLIENT_DIR="client64"
117 | + fi
118 | PDO_OCI_IC_PREFIX="`echo $PDO_OCI_DIR | cut -d, -f2`"
119 | PDO_OCI_IC_VERS="`echo $PDO_OCI_DIR | cut -d, -f3`"
120 | + if test -n "$PDO_OCI_IC_VERS"; then
121 | + PDO_OCI_IC_MAJ_VER="`echo $PDO_OCI_IC_VERS | cut -d. -f1`"
122 | + if test "$PDO_OCI_IC_MAJ_VER" -ge 11; then
123 | + # From 11.1.0.7 the RPM path only has an X.Y component
124 | + PDO_OCI_IC_VERS="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
125 | + fi
126 | + fi
127 | AC_MSG_CHECKING([for oci.h])
128 | - if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client/oci.h ; then
129 | - PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
130 | - AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
131 | - elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
132 | - PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
133 | - AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
134 | + if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/oci.h ; then
135 | + PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
136 | + AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
137 | + elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
138 | + PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
139 | + AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
140 | elif test -f $PDO_OCI_IC_PREFIX/sdk/include/oci.h ; then
141 | PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/sdk/include)
142 | AC_MSG_RESULT($PDO_OCI_IC_PREFIX/sdk/include)
143 | - elif test -f $PDO_OCI_IC_PREFIX/client/include/oci.h ; then
144 | - PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/client/include)
145 | - AC_MSG_RESULT($PDO_OCI_IC_PREFIX/client/include)
146 | + elif test -f $PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
147 | + PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
148 | + AC_MSG_RESULT($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
149 | else
150 | - AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant client install])
151 | + AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your Instant Client install])
152 | fi
153 | - if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.so" ; then
154 | - PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
155 | - elif test -f "$PDO_OCI_IC_PREFIX/client/lib/libclntsh.so" ; then
156 | - PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/client/lib"
157 | - elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.so" ; then
158 | + if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
159 | + PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib"
160 | + elif test -f "$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
161 | + PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib"
162 | + elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.$SHLIB_SUFFIX_NAME" ; then
163 | PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
164 | else
165 | - AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your instant client install])
166 | + AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your Instant Client install])
167 | fi
168 | PDO_OCI_VERSION="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
169 | else
170 | + AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)
171 | +
172 | if test -d "$PDO_OCI_DIR/rdbms/public"; then
173 | PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)
174 | PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/public"
175 | @@ -137,29 +147,12 @@
176 | fi
177 |
178 | case $PDO_OCI_VERSION in
179 | - 8.0)
180 | - PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", PDO_OCI_SHARED_LIBADD)
181 | - PHP_ADD_LIBRARY_WITH_PATH(core4, "", PDO_OCI_SHARED_LIBADD)
182 | - PHP_ADD_LIBRARY_WITH_PATH(psa, "", PDO_OCI_SHARED_LIBADD)
183 | - PHP_ADD_LIBRARY_WITH_PATH(clntsh, $PDO_OCI_LIB_DIR, PDO_OCI_SHARED_LIBADD)
184 | - ;;
185 | -
186 | - 8.1)
187 | + 9.0|10.1|10.2|11.1|11.2)
188 | PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
189 | ;;
190 |
191 | - 9.0)
192 | - PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
193 | - ;;
194 | -
195 | - 10.1)
196 | - PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
197 | - ;;
198 | - 10.2)
199 | - PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
200 | - ;;
201 | *)
202 | - AC_MSG_ERROR(Unsupported Oracle version! $PDO_OCI_VERSION)
203 | + AC_MSG_ERROR(Unsupported Oracle version $PDO_OCI_VERSION)
204 | ;;
205 | esac
206 |
207 | @@ -221,18 +214,18 @@
208 | ],[
209 | AC_MSG_CHECKING([for PDO includes])
210 | if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
211 | - pdo_inc_path=$abs_srcdir/ext
212 | + pdo_cv_inc_path=$abs_srcdir/ext
213 | elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
214 | - pdo_inc_path=$abs_srcdir/ext
215 | + pdo_cv_inc_path=$abs_srcdir/ext
216 | elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
217 | - pdo_inc_path=$prefix/include/php/ext
218 | + pdo_cv_inc_path=$prefix/include/php/ext
219 | else
220 | AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
221 | fi
222 | - AC_MSG_RESULT($pdo_inc_path)
223 | + AC_MSG_RESULT($pdo_cv_inc_path)
224 | ])
225 |
226 | - PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_inc_path)
227 | + PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_cv_inc_path)
228 |
229 | PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD)
230 | PHP_SUBST_OLD(PDO_OCI_DIR)
231 | @@ -242,7 +235,6 @@
232 | [
233 | PHP_ADD_EXTENSION_DEP(pdo_oci, pdo)
234 | ])
235 | -
236 | -fi
237 |
238 | + AC_DEFINE_UNQUOTED(PHP_PDO_OCI_CLIENT_VERSION, "$PDO_OCI_VERSION", [ ])
239 | fi
240 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | phpfarm for docker
2 | ==================
3 |
4 | This is a build file to create a [phpfarm](https://github.com/fpoirotte/phpfarm) setup. The resulting docker image will run Apache on different ports with different PHP versions accessed via FCGI. The different PHP CLI binaries are accessible as well.
5 |
6 | [](https://circleci.com/gh/splitbrain/docker-phpfarm)
7 |
8 |
9 | Port | PHP Version | Binary
10 | -----|-------------|-----------------------
11 | 8051 | 5.1.6 | php-5.1 (wheezy only)
12 | 8052 | 5.2.17 | php-5.2 (wheezy only)
13 | 8053 | 5.3.29 | php-5.3
14 | 8054 | 5.4.45 | php-5.4
15 | 8055 | 5.5.38 | php-5.5
16 | 8056 | 5.6.39 | php-5.6
17 | 8070 | 7.0.33 | php-7.0
18 | 8071 | 7.1.25 | php-7.1
19 | 8072 | 7.2.34 | php-7.2
20 | 8073 | 7.3.25 | php-7.3 (jessie only)
21 | 8074 | 7.4.13 | php-7.3 (jessie only)
22 | 8080 | 8.0.0 | php-8.0 (jessie only)
23 | 8000 | nightly | php-x.x (currently unavailable)
24 |
25 | There are two tags for this image: ``wheezy`` and ``jessie``, referring to the underlying Debian base system releases. Unless you need PHP 5.1 or 5.2 you should always use the ``jessie`` tag.
26 |
27 | The ``wheezy`` image is deprecated and may not run on modern Linux kernels anymore! Booting your host system with `vsyscall=emulate` kernel parameter may help if you really need it.
28 |
29 | The `nightly` build refers to the current `master` when the image was built. You probably want to rebuild the image yourself if you need to test against a very recent snapshot. See next section on how to do that.
30 |
31 | Building the image
32 | ------------------
33 |
34 | After cloning the git repository, simply run the following command:
35 |
36 | docker build -t splitbrain/phpfarm:jessie -f Dockerfile-Jessie .
37 | docker build -t splitbrain/phpfarm:wheezy -f Dockerfile-Wheezy .
38 |
39 | This will setup a Debian base system, install phpfarm, download and compile the different PHP versions, extensions and setup Apache. So, yes this will take a while. See the next section for a faster alternative.
40 |
41 | On Kernel 4.19 there seems to be a [bug](https://www.spinics.net/lists/linux-unionfs/msg06109.html). You need to disable the metacopy feature of the overlay filesystem to build the image. ``echo N > /sys/module/overlay/parameters/metacopy``
42 |
43 | Downloading the image
44 | ---------------------
45 |
46 | Simply downloading the ready made image from Docker Hub is probably the fastest way. Just run one of these:
47 |
48 | docker pull splitbrain/phpfarm:jessie
49 | docker pull splitbrain/phpfarm:wheezy
50 |
51 | Running the container
52 | ---------------------
53 |
54 | The following will run the container and map all ports to their respective ports on the local machine. The current working directory (`$PWD`) will be used as the document root for the Apache server and the server itself will run with the same user id as your current user (`$UID`).
55 |
56 | docker run --rm -t -i -e APACHE_UID=$UID -v $PWD:/var/www:rw \
57 | -p 8051:8051 -p 8052:8052 -p 8053:8053 -p 8054:8054 -p 8055:8055 \
58 | -p 8056:8056 -p 8070:8070 -p 8071:8071 -p 8072:8072 -p 8073:8073 \
59 | -p 8074:8074 -p 8080:8080 \
60 | splitbrain/phpfarm:jessie
61 |
62 | You can access the Apache/PHP via localhost. Eg. `http://localhost:8073` for the PHP 7.3 version. The nightly build is available on port `8000`.
63 |
64 | Above command will also remove the container again when the process is aborted with CTRL-C (thanks to the `--rm` option). While running, the Apache and PHP error log is shown on STDOUT.
65 |
66 | An alternative is to not isolate the container's network at all from the local machine. This makes it possible for the container to access all the services you're running locally, eg. a database. It will also automatically make all the exposed ports available locally (but you can't remap them, so they need to be available, eg. not used by anything else). To do so use the `--network host` switch:
67 |
68 | docker run --rm -t -i -e APACHE_UID=$UID -v $PWD:/var/www:rw \
69 | --network host splitbrain/phpfarm:jessie
70 |
71 | You can also access the PHP binaries within the container directly. Refer to the table above for the correct names. The following command will run PHP 5.3 on your current working directory.
72 |
73 | docker run --rm -t -i -v $PWD:/var/www:rw splitbrain/phpfarm:jessie php-5.3 --version
74 |
75 | Alternatively you can also run an interactive shell inside the container with your current working directory mounted.
76 |
77 | docker run --rm -t -i -v $PWD:/var/www:rw splitbrain/phpfarm:jessie /bin/bash
78 |
79 | Loading custom php.ini settings
80 | -------------------------------
81 |
82 | All PHP versions are compiled with the config-file-scan-dir pointing to ``/var/www/.php/``. When mounting your own project as a volume to ``/var/www/`` you can easily place custom ``.ini`` files in your project's ``.php/`` directory and they should be automatically be picked up by PHP.
83 |
84 | XDebug debugging, profiling and tracing
85 | ---------------------------------------
86 |
87 | XDebug is enabled in all of the PHP versions. It is preconfigured for immeadiate use.
88 |
89 | Profiling and tracing can be triggered through the `XDEBUG_PROFILE` and `XDEBUG_TRACE` Post/Get/Ccookie setting - no special trigger value has been set, so any value will trigger. Output files are placed into the volume you mounted to `/var/www/` with an `xdebug.` prefix.
90 |
91 | Remote debugging is triggered through the `XDEBUG_SESSION` cookie. It uses the `remote_connect_back` setting, so it expects a debugger on port `9000` (the default) on the IP that requested the page.
92 |
93 | Of course you can always reconfigure xdebug through a custom ini file as described above.
94 |
95 | Using the image for Testing in Gitlab-CI
96 | ----------------------------------------
97 |
98 | [Gitlab-CI](https://about.gitlab.com/gitlab-ci/) users can use this image to automate testing against different PHP versions. For detailed info refer to the gitlab-ci documentation.
99 |
100 | Here's a simple ``.gitlab-ci.yml`` example using phpunit.
101 |
102 | stages:
103 | - test
104 |
105 | image: splitbrain/phpfarm:jessie
106 |
107 | php-5.3:
108 | stage: test
109 | script:
110 | - wget https://phar.phpunit.de/phpunit-old.phar -O phpunit
111 | - php-5.3 phpunit --coverage-text --colors=never
112 |
113 | php-5.4:
114 | stage: test
115 | script:
116 | - wget https://phar.phpunit.de/phpunit-old.phar -O phpunit
117 | - php-5.4 phpunit --coverage-text --colors=never
118 |
119 | php-5.6:
120 | stage: test
121 | script:
122 | - wget https://phar.phpunit.de/phpunit.phar -O phpunit
123 | - php-5.6 phpunit --coverage-text --colors=never
124 |
125 | php-7.0:
126 | stage: test
127 | script:
128 | - wget https://phar.phpunit.de/phpunit.phar -O phpunit
129 | - php-7.0 phpunit --coverage-text --colors=never
130 |
131 | Supported PHP extensions
132 | ------------------------
133 |
134 | Here's a list of the extensions available in each of the PHP versions available in the Jessie image. It should cover all the default extensions plus a few popular ones and xdebug for debugging.
135 |
136 | Extension | PHP 5.3 | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.0 | PHP 7.1 | PHP 7.2 | PHP 7.3 | PHP 7.4 | PHP 8.0
137 | ------------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:
138 | bcmath | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
139 | bz2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
140 | calendar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
141 | cgi-fcgi | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
142 | ctype | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
143 | curl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
144 | date | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
145 | dom | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
146 | ereg | ✓ | ✓ | ✓ | ✓ | | | | | |
147 | exif | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
148 | fileinfo | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
149 | filter | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
150 | ftp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
151 | gd | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
152 | gettext | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
153 | hash | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
154 | iconv | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
155 | imap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
156 | intl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
157 | json | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
158 | ldap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
159 | libxml | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
160 | mbstring | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
161 | mcrypt | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | |
162 | mhash | ✓ | ✓ | ✓ | ✓ | | | | | |
163 | mysql | ✓ | ✓ | ✓ | ✓ | | | | | |
164 | mysqli | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
165 | mysqlnd | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
166 | openssl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
167 | pcntl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
168 | pcre | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
169 | pdo | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
170 | pdo_mysql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
171 | pdo_pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
172 | pdo_sqlite | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
173 | pgsql | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
174 | phar | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
175 | posix | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
176 | reflection | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
177 | session | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
178 | simplexml | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
179 | soap | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
180 | sockets | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
181 | spl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
182 | sqlite | ✓ | | | | | | | | |
183 | sqlite3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
184 | standard | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
185 | tokenizer | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
186 | wddx | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
187 | xdebug | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
188 | xml | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
189 | xmlreader | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
190 | xmlwriter | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
191 | xsl | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
192 | zip | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
193 | zlib | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓
194 |
--------------------------------------------------------------------------------