A Linux base image that makes it easy to compile and/or use any version of PHP.
3.2K
This 'Linux for PHP Ultimate' base image is based on asclinux/linuxforphp-8.2:composer and contains all the software and libraries that are necessary to successfully COMPILE ('src' tag) and/or USE (version number tags) any version of PHP, with all compilation options.
User root's password: toor
$ docker run -dit \
-v ${PWD}/:/srv/www \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
asclinux/linuxforphp-8.2-ultimate:7.4-nts \
lfphp
$ docker run --rm -it asclinux/linuxforphp-8.2-ultimate:src /bin/bash
On the container's CLI:
$ cd
$ wget -O php-7.4.2.tar.xz http://php.net/get/php-7.4.2.tar.xz/from/this/mirror
$ tar -xvf php-7.4.2.tar.xz
$ cd php-7.4.2
$ ./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 \
--enable-pcntl \
--with-pspell \
--with-readline \
--with-snmp \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-curl \
--with-openssl \
--with-openssl-dir=/usr \
--with-mhash \
--enable-intl \
--with-sodium=/usr \
--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-mssql \
--with-pdo-dblib \
--with-ldap \
--with-ldap-sasl \
--enable-shmop \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg \
--with-tidy \
--enable-wddx \
--with-libexpat-dir \
--with-enchant \
--with-imap=/usr/local/imap-2007f \
--with-imap-ssl=/usr/include/openssl \
--with-kerberos=/usr/include/krb5 \
--enable-zip \
--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.4.2
$ install -v -m644 CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \
$ /usr/share/doc/php-7.4.2
$ ln -v -sfn /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
$ /usr/share/doc/php-7.4.2
$ ln -v -sfn /usr/lib/php/doc/Structures_Graph/docs \
$ /usr/share/doc/php-7.4.2
$ 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
$ /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.
$ docker run --rm -it \
-v ${PWD}/:/srv/www \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
asclinux/linuxforphp-8.2-ultimate:src \
/bin/bash
On the container's CLI:
$ cd
$ lfphp-compile 7.4.2 zts
$ php -v
List of installed software/libraries:
ASCLinux, Linux for PHP and the Linux for PHP logo are registered trademarks.
Content type
Image
Digest
sha256:2bed779b2…
Size
877.1 MB
Last updated
12 months ago
docker pull asclinux/linuxforphp-8.2-ultimate:8.2-nts