This lightweight Linux base image makes it easy to compile recent versions of PHP from source.
665
This 'Linux for PHP' base image is based on asclinux/asclinux:8.1 and contains all the software and libraries that are necessary to successfully COMPILE recent versions of PHP. It therefore does NOT contain the PHP binaries or libraries. You are expected to compile those yourself.
User root's password: toor
$ docker run --rm -it \
-v ${PWD}/:/srv/www \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
asclinux/linuxforphp \
/bin/bash
On the container's CLI:
$ cd
$ wget -O php-7.2.12.tar.xz http://php.net/get/php-7.2.12.tar.xz/from/this/mirror
$ tar -xvf php-7.2.12.tar.xz
$ cd php-7.2.12
$ ./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--datadir=/usr/share/php \
--mandir=/usr/share/man \
--enable-fpm \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-config-file-path=/etc \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--enable-dba=shared \
--with-gdbm \
--with-gmp \
--enable-ftp \
--with-gettext=/usr \
--enable-mbstring \
--with-readline \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-curl \
--with-openssl \
--with-openssl-dir=/usr \
--with-sodium=/usr \
--enable-intl \
--with-sodium=/usr \
--enable-zip \
--with-libxml-dir=/usr \
--with-libdir=/lib64 \
--enable-sockets \
--enable-libxml \
--enable-soap \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-freetype-dir=/usr \
--enable-exif \
--with-xsl \
--with-xmlrpc \
--with-pgsql \
--with-pdo-mysql=/usr \
--with-pdo-pgsql \
--with-mysqli \
--with-ldap \
--with-ldap-sasl \
--enable-opcache
$ make
$ make test
$ make install
$ php -v
$ docker run --rm -it asclinux/linuxforphp /bin/bash
On the container's CLI:
$ cd
$ git clone https://github.com/php/php-src
$ cd php-src
$ git checkout tags/php-7.2.12
$ ./buildconf --force
$ ./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--datadir=/usr/share/php \
--mandir=/usr/share/man \
--enable-fpm \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-config-file-path=/etc \
--with-zlib \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--enable-dba=shared \
--with-gdbm \
--with-gmp \
--enable-ftp \
--with-gettext=/usr \
--enable-mbstring \
--with-readline \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-curl \
--with-openssl \
--with-openssl-dir=/usr \
--with-sodium=/usr \
--enable-intl \
--with-sodium=/usr \
--enable-zip \
--with-libxml-dir=/usr \
--with-libdir=/lib64 \
--enable-sockets \
--enable-libxml \
--enable-soap \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-freetype-dir=/usr \
--enable-exif \
--with-xsl \
--with-xmlrpc \
--with-pgsql \
--with-pdo-mysql=/usr \
--with-pdo-pgsql \
--with-mysqli \
--with-ldap \
--with-ldap-sasl \
--enable-opcache
$ make
$ make test
$ make install
$ php -v
$ install -v -m644 php.ini-production /etc/php.ini
$ mv -v /etc/php-fpm.conf{.default,}
$ install -v -m755 -d /usr/share/doc/php-7.2.12
$ install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \
$ /usr/share/doc/php-7.2.12
$ ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
$ /usr/share/doc/php-7.2.12
$ ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \
$ /usr/share/doc/php-7.2.12
$ cp -v /etc/php-fpm.d/www.conf.default /etc/php-fpm.d/www.conf
$ sed -i 's@php/includes"@&\ninclude_path = ".:/usr/lib/php"@' \
$ /etc/php.ini
$ sed -i -e '/proxy_module/s/^#//' \
$ -e '/proxy_fcgi_module/s/^#//' \
$ /etc/httpd/httpd.conf
$ echo \
$ '#ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/srv/www/$1' >> \
$ /etc/httpd/httpd.conf
$ sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/' /etc/httpd/httpd.conf
$ sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/httpd.conf
$ sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /etc/httpd/httpd.conf
$ cat >>/etc/httpd/httpd.conf << 'EOF'
<Proxy "fcgi://127.0.0.1:9000">
ProxySet min=0
ProxySet timeout=1800
</Proxy>
<FilesMatch .php$>
# 2.4.10+ can proxy to unix socket
# SetHandler "proxy:unix:/run/php-fpm.sock|fcgi://localhost/"
# Else we can just use a tcp socket:
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
EOF
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php --install-dir=/usr/local/bin
$ mv /usr/local/bin/composer.phar /usr/local/bin/composer
$ php -r "unlink('composer-setup.php');"
$ /etc/init.d/mysql start
$ /usr/sbin/php-fpm &
$ /etc/init.d/httpd start
You would then be able to run your PHP scripts on the CLI or through the included Apache server.
List of installed software/libraries:
ASCLinux, Linux for PHP and the Linux for PHP logo are registered trademarks.
Content type
Image
Digest
Size
549.4 MB
Last updated
over 6 years ago
docker pull asclinux/linuxforphp