Sign inSign up

asclinux/linuxforphp

By asclinux

•Updated over 6 years ago

This lightweight Linux base image makes it easy to compile recent versions of PHP from source.

Image
1

665

asclinux/linuxforphp repository overview

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

⁠Example usage:
$ 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
⁠Another example usage:
$ 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.

⁠Additional information

List of installed software/libraries:

  • Acl (2.2.52)
  • Apache (2.4.27)
  • Apr (1.6.2)
  • Apr-Util (1.6.0)
  • Attr (2.4.47)
  • Autoconf (2.69)
  • Automake (1.15)
  • Bash (4.3.30)
  • Bc (1.06.95)
  • Berkeley DB (6.2.32)
  • Binutils (2.27)
  • Bison (3.0.4)
  • Bzip2 (1.0.6)
  • c-ares (1.12.0)
  • Certificate Authority Certificates
  • Check (0.10.0)
  • CMake (3.9.1)
  • Coreutils (8.25)
  • cURL (7.55.1)
  • Cyrus-SASL (2.1.26)
  • DejaGNU (1.6)
  • DHCP Client (4.3.6)
  • Diffutils (3.5)
  • Docbook-xml (4.5)
  • Docbook-xsl (1.79.1)
  • Eudev (3.2)
  • E2fsprogs (1.43.1)
  • Exim (4.89.1)
  • Expat (2.2.0)
  • Expect (5.45)
  • File (5.28)
  • Findutils (4.6.0)
  • Flex (2.6.1)
  • Fontconfig (2.12.4)
  • FreeType (2.8)
  • Gawk (4.1.3)
  • GCC (6.2.0)
  • GDBM (1.12)
  • Gettext (0.19.8.1)
  • Git (2.14.1)
  • Glibc (2.24)
  • GMP (6.1.1)
  • GnuTLS (3.5.14)
  • Gperf (3.0.4)
  • Grep (2.25)
  • Groff (1.22.3)
  • GRUB (2.02~beta3)
  • Gzip (1.8)
  • Iana-Etc (2.30)
  • icu4c (59.1)
  • Inetutils (1.9.4)
  • Intltool (0.51.0)
  • IPRoute2 (4.7.0)
  • Kbd (2.0.3)
  • Kmod (23)
  • Less (481)
  • LFS-Bootscripts (20150222)
  • libarchive (3.3.2)
  • Libcap (2.25)
  • libevent (2.1.8)
  • libexif (0.6.21)
  • libffi (3.2.1)
  • libgd (2.2.4)
  • libjpeg-turbo (1.5.2)
  • libmcrypt (2.5.8)
  • libnghttp2 (1.32.0)
  • Libpipeline (1.4.1)
  • libpng (1.6.31)
  • libsodium (1.0.15)
  • libtasn (1-4.12)
  • Libtool (2.4.6)
  • libunistring (0.9.7)
  • libxml (2-2.9.4)
  • libxslt (1.1.29)
  • libzip (1.6.1)
  • Linux (4.7.2) - Kernel is NOT installed in this Docker image!
  • LZO (2.10)
  • M4 (1.4.17)
  • Make (4.2.1)
  • Man-DB (2.7.5)
  • Man-pages (4.07)
  • MariaDB (10.2.8)
  • mcrypt (2.6.8)
  • mhash (0.9.9.9)
  • MPC (1.0.3)
  • MPFR (3.1.4)
  • Ncurses (6.0)
  • Nettle (3.3)
  • nginx (1.13.12)
  • oniguruma (6.9.5)
  • OpenLDAP (2.4.45)
  • OpenSSL (1.0.2l)
  • p11-kit (0.23.8)
  • Patch (2.7.5)
  • PCRE (8.41)
  • Perl (5.24.0)
  • Pkg-config (0.29.1)
  • PostgreSQL (9.6.4)
  • Procps (3.3.12)
  • Psmisc (22.21)
  • Python (2.7.13)
  • Python (3.6.2)
  • re2c (1.1.1)
  • Readline (6.3)
  • Ruby (2.4.1)
  • runit (2.1.2)
  • runit-docker (1.1.0)
  • Sed (4.2.2)
  • SGML-common (0.6.3)
  • Shadow (4.2.1)
  • SQLite (3.20.0)
  • Sysklogd (1.5.1)
  • Sysvinit (2.88dsf)
  • Tar (1.29)
  • Tcl (8.6.7)
  • Texinfo (6.1)
  • Time Zone Data (2016f)
  • Udev-lfs Tarball (udev-lfs-20140408)
  • UnZip (6.0)
  • Util-linux (2.28.1)
  • Vim (7.4)
  • Wget (1.19.1)
  • XML::Parser (2.44)
  • Xz Utils (5.2.2)
  • yasm (1.3.0)
  • Zip (3.0)
  • Zlib (1.2.8)
⁠Have a lot of fun!

ASCLinux, Linux for PHP and the Linux for PHP logo are registered trademarks.

Tag summary

Content type

Image

Digest

Size

549.4 MB

Last updated

over 6 years ago

docker pull asclinux/linuxforphp