loading...

Hands on with PHP7.4

adhocore profile image Jitendra Adhikari ・1 min read

As most of us already know, PHP7.4 became production ready few days back. It comes with some cool features like:

  • Short Arrow Functions
  • Spread Operator for Arrays
  • Typed Properties
  • Opcache Preloading

... and much more! We can't thank the team behind PHP enough!

If you are a PHP developer or PHP enthusiast you must be excited already to get hands on with PHP7.4.

If you want to give it a try with ease - the docker way, then I have created a docker image with not just PHP7.4 but tons of common and useful PHP extensions. Check it out.

TLDR: docker pull adhocore/phpfpm:7.4

GitHub logo adhocore / docker-phpfpm

Docker PHP FPM on alpine with PHP7.4.6:and 84 cool extensions

docker-phpfpm

Docker PHP FPM with lean alpine base. The download size is just about ~100MB.

It contains PHP7.4.8 with plenty of common and useful extensions.

If you are looking for a complete local development stack then check adhocore/lemp.

Usage

To pull latest image:

docker pull adhocore/phpfpm:7.4

To use in docker-compose

# ./docker-compose.yml
version: '3'
services
  phpfpm
    image: adhocore/phpfpm:7.4
    container_name: phpfpm
    volumes:
      # Here you can also volume php ini settings
      # - /path/to/zz-overrides:/usr/local/etc/php/conf.d/zz-overrides.ini
    ports:
      - 9000:9000
    environment:
      # ...

Extensions

The following PHP extensions are installed:

- apcu              - ast               - bcmath            - bz2
- calendar          - core              - ctype             - curl
- date              - dom               - ds                - ev
- event             - exif              - fileinfo          - filter
- ftp               - gd                - gettext           - gmp
- hash              - hrtime            - iconv             - igbinary
- imagick           - imap              -

If you want a full docker based LEMP stack with PHP7.4, then I have got you covered as well.

TLDR: Run docker run -p 8080:80 -v $(pwd):/var/www/html --name lemp -d adhocore/lemp:7.4 then visit localhost:8080. There you have dockerized LEMP stack with PHP7.4.

GitHub logo adhocore / docker-lemp

A single container LEMP fullstack with PHP7.4, MySQL, nginx, PostgreSQL, phalcon, mailcatcher, beanstalkd, elasticsearch, memcached, redis and adminer on top alpine

docker-lemp

Do not use this LEMP in Production.

For production, use adhocore/phpfpm then compose a stack using individual nginx, redis, mysql etc images.

adhocore/lemp is a minimal single container LEMP full stack for local development.

It is quick jumpstart for onboarding you into docker based development.

The docker container adhocore/lemp is composed of:

Name Version Port
adminer 4.7.7 80
alpine 3.12 -
beanstalkd 1.11 11300
elasticsearch 6.4.3 9200,9300
mailcatcher 0.7.1 88
memcached 1.6.6 11211
MySQL* 5.7 3306
nginx 1.18.0 80
phalcon 4.0.0 -
PHP 7.4.8 9000
PostgreSQL 12.3 5432
redis 5.0.9 6379
swoole 4.4.12 -

*: It is actually MariaDB 10.4.13.

Usage

Install docker in your machine Also recommended to install docker-compose.

# pull latest image
docker pull adhocore/lemp:7.4
# Go to your project root then run
docker run -p 8080:80 -p 8888:88 -v `pwd`:/var/www/html --name lemp -d adhocore/lemp:7.4
# In windows,

Oh and both the images are built on top alpine base so should be slimmer.

Further reading

PHP7.4 Changelog
PHP7.4 Benchmark

Discussion

pic
Editor guide