With the official release of PHP 8 at the end of November 2020, I've been extremely keen to test several of my cloud-based websites
against the new version. Who knows, perhaps it's the "gambling man" in me, or perhaps it's a masochistic pass-time: watching
to see if the website still works, or if it just rolls over and plays dead? In any event, sadly, I've had to resort to some
fancy footwork in my Dockerfiles to run tests. However my long, anxious wait is now over: the official
LfPHP Docker image for PHP 8.0 is here! I'm very pleased to announce that the wait for PHP 8 is over!.
If you head over to Docker hub, under the asclinux images page, you'll see a new member of the family:
There is also a thread-safe version:
Before I get into the juicy details, I need to back up for a second and give you a little history behind the new images.
As those of you who have become enamored of the LfPHP family of images are well aware, there has been an LfPHP Docker image
for PHP 8 for almost a year now! Yes, you heard me right: my friend and famous colleague Andrew Caya
created an image for PHP 8 when it was still Alpha. In addition, LfPHP has always had a
that allows you to install your own version of PHP 8 (or any version of PHP for that matter). Compiling PHP was just a matter of
either using the
lfphp-compile utility, or manually compiling PHP using the built-in gcc compiler included with any LfPHP image.
As you would suspect, the same healthy compliment of PHP modules as you have come to rely-upon in earlier releases of the LfPHP Docker image are all there. Here is the complete list of PHP modules included by default:
bcmath bz2 calendar Core ctype curl date dom enchant exif FFI fileinfo filter ftp gd gettext gmp hash iconv imap intl json
ldap libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix pspell readline Reflection session shmop SimpleXML
snmp soap sockets sodium SPL sqlite3 standard sysvmsg sysvsem sysvshm tidy tokenizer xdebug xml xmlreader xmlwriter xsl zip zlib [Zend Modules] Xdebug
If you don't find what you're looking for in the LfPHP image, don't forget about the handy lfphp-get utility.
Here is a the complete list of currently available packages after running
aiolib alsalib aspell bind-utils blackfire chronograf cms cpio cups doxygen elasticsearch68 elixir enchant-2.0 enchant-1.6 erlang exakat expect fcron freetds giflib glib
grafana imagemagick imapcclient influxdb java kapacitor krb5 lfphp libmemcached libuv memcached meson mongodb msmtp mysql57 mysql80 net-tools ninja nodejs openssh opensshinit
php-ext php-frameworks phpmyadmin rabbitmq-client rabbitmq-server redis rsync sass scons serf siege snmp subversion telegraf tidyhtml varnish-cache webalizer which xorgcore
You can also add the
--compile flag at the end of an
This forces the utility to compile directly from source instead of downloading pre-compiled binaries.
It's also important to remember that the
php-frameworks directive offers an additional list of packages.
Here's what you see if you type
-------------------------------------------------------- 1 - Zend Framework Skeleton Application 2 - Zend Expressive Skeleton Application 3 - Symfony Application 4 - Laravel Application 5 - CakePHP Application 6 - Slim PHP Skeleton Application 7 - LightMVC Framework Skeleton Application 8 - LightMVC Framework Skeleton Application WITH Swoole 9 - Laminas (Zend Framework 3) Skeleton Application 10 - Mezzio (Zend Expressive) Skeleton Application --------------------------------------------------------
You can also install any PHP extension using the
lfphp-get php-ext NNN syntax.
Just replace the short name of the extension in place of
NNN and away you go.
lfphp-compile is also available. It's a companion to
lfphp-get, but is designed
specifically to compile a PHP version directly from source.
Strangely, the very power of
lfphp-compile is also what caused me to have to pull off some fancy footwork in order to
compile a version of PHP 8.0! In the current version of
lfphp-compile, if you specify any PHP version starting with
lfphp-compile does is to download and compile the latest version of PHP. So once the official PHP 8.0 version was
released, the intrepid PHP core development team immediately started working on the next release, namely PHP 8.1!
So what I ended up getting was an LfPHP image with PHP 8.1 instead of plain old PHP 8.0! I ended up having to edit the
lfphp-compile utility and manually override the version in order to fall back to PHP 8.0.
Having said all of this ... it turns out there is now a new image available that offers you a sneak peak at PHP 8.1. Here is an example of how to run the new image:
ned@ned:~$ docker run -it asclinux/linuxforphp-8.2-ultimate:8.1dev-nts /bin/bash root@7bd19d37d8a4 [ / ]# php --version PHP 8.1.0-dev (cli) (built: Dec 24 2020 00:13:50) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.1.0-dev, Copyright (c) Zend Technologies root@7bd19d37d8a4 [ / ]#
For information about what's going to be PHP 8.1, have a look at these resources:
As always, it's my pleasure to do my small part to contribute towards any developer's success in the PHP world. I've been working with the LfPHP Docker image for a couple of years now and have found it to be consistently stable and highly performant. It's rich with features and has saved me hours of work trying to set up a solid cloud infrastructure. I hope you will say the same in a few years. Happy coding1