In order to start using Linux for PHP, you must install Docker on your computer first. Please read the Docker documentation for further details.

Once Docker is installed, please enter the following command to run the Linux for PHP image with the non thread-safe version of PHP 7.4.2 :

docker run --rm -it asclinux/linuxforphp-8.2-ultimate:7.4-nts /bin/bash

You can now run any PHP script from the command line. Once you are done with the container, please quit the container by typing :


And, what if you wish to run a PHP application from a Web browser and start the Linux for PHP container in Docker's detached mode? To do so, enter the following command :

# Change to your project's working directory
cd /my/project/folder
docker run -dit --restart=always \
-v ${PWD}/:/srv/www \
-p 8181:80 \
-p 10443:443 \
asclinux/linuxforphp-8.2-ultimate:7.4-nts \

You should now be able to access any of the PHP scripts contained in your project folder by pointing your browser to http://localhost:8181.

Finally, what if you want to compile and use a different version of PHP? In a new terminal window, enter the following command, making sure you enter the version that you wish to compile (8.0.0dev in this example) :

docker run --rm -it -p 8181:80 asclinux/linuxforphp-8.2-ultimate:src /bin/bash -c "lfphp-compile 8.0.0 nts ; echo '<?php phpinfo();' > /srv/www/index.php ; /bin/bash"

Alternatively, you could also decide to do it manually. If so, start by running a Linux for PHP base image containing the PHP source files with the following command :

docker run --rm -it asclinux/linuxforphp-8.2-ultimate:src /bin/bash -c "cd ; git clone https://github.com/php/php-src ; /bin/bash"

And, on the container's command line interface (CLI), checkout the version of PHP you wish to compile and begin compilation by entering the following commands (in our example, we will compile from master) :

cd /root/php-src
git fetch --all --tags
git pull origin master
./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-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-ldap \
--with-ldap-sasl \
make test
make install
install -v -m644 php.ini-production /etc/php.ini
mv -v /etc/php-fpm.conf{.default,}
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://$1' >> /etc/httpd/httpd.conf
sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /etc/httpd/httpd.conf
/etc/init.d/mysql start
/usr/sbin/php-fpm &
/etc/init.d/httpd start

Have a lot of fun!