Skip to content

Docker image for php7-fpm with all the extensions needed to run Laravel 8+, Lumen and other PHP projects.

License

Notifications You must be signed in to change notification settings

otherguy/docker-php7-fpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP 7.4 FPM

All-purpose PHP-FPM 7.4 Docker image that comes with the most popular extensions.

Docker Pulls Docker Stars Travis CI GitHub issues MicroBadger Layers GitHub stars MIT License

Don't worry about building complex Docker images for your Laravel, Lumen or other PHP 7.4+ applications. Just use this lightweight and convenient image.

$ docker pull otherguy/php7-fpm:7.4

🌈 Quick Start

Create your Docker image

Base your Docker image on otherguy/php7-fpm:7.4, add your project files and you're ready to go!

# Dockerfile
FROM otherguy/php7-fpm:7.4

COPY --chown=www-data:www-data . /srv

Customize PHP settings

If you want to change the PHP configuration or overwrite some defaults, simply create your own configuration file, have the filename start with a z and add it to the image.

# zz-custom.ini
post_max_size       = 100M
upload_max_filesize = 100M
# Dockerfile
...
COPY zz-custom.ini /usr/local/etc/php/conf.d/
...

Add PHP extensions

It's simple to add your own extensions to the image!

# Dockerfile
...
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
 && pecl install mongodb \
 && docker-php-ext-enable mongodb
...

📚 Description

This is a docker image for an all-purpose PHP-FPM (PHP Version 7.4) container. It is based on the 7.4-fpm-alpine tag of the official PHP Docker image. Patch version upgrades are therefore done automatically on build (e.g. 7.4.11 to 7.4.12) but for minor version upgrades (e.g. 7.3.x to 7.4.x), a new Dockerfile should be created and tagged appropriately.

🆕 New and Removed Features

There are some new features and deprecated modules that made changes to the Dockerfile necessary:

  • mcrypt has been deprecated in 7.1 and removed in 7.2 in favor of OpenSSL
  • PHP 7.4 includes many of the extensions that were previously installed manually, so only gd, intl, opcache and PDO are installed through this image

🧮 Extensions

The installed extensions are enough for Laravel 8 projects as long as the project is using either PostgreSQL, MySQL or SQLite. If you need other database drivers/extensions, please fork this image and submit a pull requests, or simply install it in your own image.

This is the full list of extensions available to PHP in this image:

  • ctype
  • curl
  • date
  • dom
  • fileinfo
  • filter
  • ftp
  • gd
  • hash
  • iconv
  • intl
  • json
  • libxml
  • mbstring
  • mysqli
  • mysqlnd
  • openssl
  • pcre
  • PDO
  • pdo_mysql
  • pdo_pgsql
  • pdo_sqlite
  • Phar
  • posix
  • readline
  • Reflection
  • session
  • SimpleXML
  • sodium
  • SPL
  • sqlite3
  • standard
  • tokenizer
  • xml
  • xmlreader
  • xmlwriter
  • Zend OPcache
  • zip
  • zlib

🛠 Building

In order to build this image yourself, simply run the following command:

$ docker build -t otherguy/php7-fpm:7.4 .

🚧 Contributing

Pull Requests are more than welcome!