# PHP-FPM Docker images
[](https://travis-ci.org/devilbox/docker-php-fpm)
[](https://github.com/devilbox/docker-php-fpm/releases)
[](https://gitter.im/devilbox/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://github.com/devilbox/docker-php-fpm)
[](https://microbadger.com/images/devilbox/php-fpm "php-fpm")
**[devilbox/docker-php-fpm](https://github.com/devilbox/docker-php-fpm)**
This repository will provide you fully functional PHP-FPM Docker images in different flavours,
versions and packed with different types of integrated PHP modules. It also solves the problem of [syncronizing file permissions](#unsynchronized-permissions) of mounted volumes between the host and the container.
| Docker Hub | Upstream Project |
|------------|------------------|
| |
|
---
#### Table of Contents
1. **[Motivation](#motivation)**
1. [Unsynchronized permissions](#unsynchronized-permissions)
2. [It gets even worse](#it-gets-even-worse)
3. [The solution](#the-solution)
2. **[PHP-FPM Flavours](#php-fpm-flavours)**
1. [Assembly](#assembly)
2. [Available Images](#available-images)
3. [Tagging](#tagging)
4. [PHP Modules](#php-modules)
3. **[PHP-FPM Features](#php-fpm-features)**
1. [Image: base](#image-base)
2. [Image: mods](#image-mods)
3. [Image: prod](#image-prod)
4. [Image: work](#image-work)
4. **[PHP-FPM Options](#php-fpm-options)**
1. [Environment variables](#environment-variables)
2. [Volumes](#volumes)
3. [Ports](#ports)
5. **[Integrated Development Environment](#integrated-development-environment)**
1. [What toos can you expect](#what-tools-can-you-expect)
2. [What else is available](#what-else-is-available)
6. **[Examples](#examples)**
1. [Provide PHP-FPM port to host](#provide-php-fpm-port-to-host)
2. [Alter PHP-FPM and system timezone](#alter-php-fpm-and-system-timezone)
3. [Load custom PHP configuration](#load-custom-php-configuration)
4. [Load custom PHP modules](#load-custom-php-modules)
5. [MySQL connect via 127.0.0.1 (via port-forward)](#mysql-connect-via-127-0-0-1-via-port-forward-)
6. [MySQL and Redis connect via 127.0.0.1 (via port-forward)](#mysql-and-redis-connect-via-127-0-0-1-via-port-forward-)
7. [Launch Postfix for mail-catching](#launch-postfix-for-mail-catching)
8. [Webserver and PHP-FPM](#webserver-and-php-fpm)
9. [Create MySQL Backups](#create-mysql-backups)
7. **[Automated builds](#automated-builds)**
8. **[Contributing](#contributing)**
9. **[Credits](#credits)**
10. **[License](#license)**
----
| Meant Tag | Actual Tag | Comment |
|---|---|---|
:latest |
:X.Y-base:X.Y-mods:X.Y-prod:X.Y-work |
Stable (rolling) These tags are produced by the master branch of this repository. |
:<git-tag-name> |
:X.Y-base-<git-tag-name>:X.Y-mods-<git-tag-name>:X.Y-prod-<git-tag-name>:X.Y-work-<git-tag-name> |
Stable (fixed) Every git tag will produce and preserve these Docker tags. |
:<git-branch-name> |
:X.Y-base-<git-branch-name>:X.Y-mods-<git-branch-name>:X.Y-prod-<git-branch-name>:X.Y-work-<git-branch-name> |
Feature (for testing) Tags produced by unmerged branches. Do not rely on them as they might come and go. |
base |
mods, prod and work |
|
|---|---|---|
| 5.3 | Core, ctype, curl, date, dom, ereg, fileinfo, filter, hash, iconv, json, libxml, mysql, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, recode, Reflection, session, SimpleXML, SPL, SQLite, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, SQLite, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 5.4 | Core, ctype, curl, date, dom, ereg, fileinfo, filter, hash, iconv, json, libxml, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, recode, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 5.5 | Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 5.6 | Core, ctype, curl, date, dom, ereg, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mhash, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apc, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, ereg, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mhash, mongo, mongodb, msgpack, mysql, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 7.0 | Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 7.1 | Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 7.2 | Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | amqp, apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcache, memcached, mongodb, msgpack, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, phalcon, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| 7.3 | Core, ctype, curl, date, dom, fileinfo, filter, ftp, hash, iconv, json, libxml, mbstring, mysqlnd, openssl, pcre, PDO, pdo_sqlite, Phar, posix, readline, Reflection, session, SimpleXML, sodium, SPL, sqlite3, standard, tokenizer, xml, xmlreader, xmlwriter, zlib | apcu, bcmath, bz2, calendar, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, interbase, intl, json, ldap, libxml, mbstring, mcrypt, memcached, mongodb, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_dblib, PDO_Firebird, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, recode, redis, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, sodium, SPL, sqlite3, standard, swoole, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, uploadprogress, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib |
| Image | Env Variable | Type | Default | Description |
|---|---|---|---|---|
| base mods prod work |
DEBUG_ENTRYPOINT |
int | 0 |
Set debug level for startup.0 Only warnings and errors are shown.1 All log messages are shown2 All log messages and executed commands are shown. |
NEW_UID |
int | 1000 |
Assign the PHP-FPM user a new uid in order to syncronize file system permissions with your host computer and the Docker container. You should use a value that matches your host systems local user.(Type id -u for your uid). |
|
NEW_GID |
int | 1000 |
Assign the PHP-FPM group a new gid in order to syncronize file system permissions with your host computer and the Docker container. You should use a value that matches your host systems local group.(Type id -g for your gid). |
|
| prod work |
TIMEZONE |
string | UTC |
Set docker OS timezone as well as PHP timezone. (Example: Europe/Berlin) |
DOCKER_LOGS |
bool | 1 |
By default all Docker images are configured to output their PHP-FPM access and error logs to stdout and stderr. Those which support it can change the behaviour to log into files inside the container. Their respective directories are available as volumes that can be mounted to the host computer. This feature might help developer who are more comfortable with tailing or searching through actual files instead of using docker logs. Set this variable to 0 in order to enable logging to files. Log files are avilable under /var/log/php/ which is also a docker volume that can be mounted locally. |
|
ENABLE_MODULES |
string | '' |
Comma separated list of PHP modules to enable, which are not enabled by default. Example: ENABLE_MODULES=ioncube |
|
DISABLE_MODULES |
string | '' |
Comma separated list of PHP modules to disable. Example: DISABLE_MODULES=swoole,imagick |
|
ENABLE_MAIL |
bool | 0 |
Enable local email catch-all. Postfix will be configured for local delivery and all mails sent (even to real domains) will be catched locally. No email will ever go out. They will all be stored in a local devilbox account. Value: 0 or 1 |
|
FORWARD_PORTS_TO_LOCALHOST |
string | List of remote ports to forward to 127.0.0.1. Format: <local-port>:<remote-host>:<remote-port>You can separate multiple entries by comma. Example: 3306:mysqlhost:3306, 6379:192.0.1.1:6379 |
||
| work | MYSQL_BACKUP_USER |
string | '' |
Username for mysql backups used for bundled mysqldump-secure |
MYSQL_BACKUP_PASS |
string | '' |
Password for mysql backups used for bundled mysqldump-secure | |
MYSQL_BACKUP_HOST |
string | '' |
Hostname for mysql backups used for bundled mysqldump-secure | |
| Image | Volumes | Description |
|---|---|---|
| prod work |
/etc/php-custom.d |
Mount this directory into your host computer and add custom \*.ini files in order to alter php behaviour. |
/etc/php-fpm-custom.d |
Mount this directory into your host computer and add custom PHP-FOM \*.conf files in order to alter PHP-FPM behaviour. |
|
/etc/php-modules.d |
Mount this directory into your host computer and add custo \*.so files in order to add your php modules.Note:Your should then also provide a custom \*.ini file in order to actually load your custom provided module. |
|
/var/log/php |
When setting environment variable DOCKER_LOGS to 0, log files will be available under this directory. |
|
/var/mail |
Emails caught be the postfix catch-all (ENABLE_MAIL=1) will be available in this directory. |
|
| work | /etc/bashrc-devilbox.d |
Mount this directory into your host computer and add custom configuration files for bash and other tools. |
/shared/backups |
Mount this directory into your host computer to access MySQL backups created by mysqldump-secure. | |
/ca |
Mount this directory into your host computer to bake any *.crt file that is located in there as a trusted SSL entity. | |
| Image | Port | Description |
|---|---|---|
| base mods prod work |
9000 |
PHP-FPM listening port |
| Tool | Description |
|---|---|
| awesome-ci | Various linting and source code analyzing tools. |
| composer | Dependency Manager for PHP. |
| drupal-console | The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal. |
| drush | Drush is a computer software shell-based application used to control, manipulate, and administer Drupal websites. |
| eslint | The pluggable linting utility for JavaScript and JSX. |
| git | Git is a version control system for tracking changes in source files. |
| git-flow | Git-flow tools. |
| gulp | Gulp command line JS tool. |
| grunt | Grunt command line JS tool. |
| jsonlint | Json command line linter. |
| laravel installer | A CLI tool to easily install and manage the laravel framework. |
| linuxbrew | The Homebrew package manager for Linux. |
| mdl | Markdown command line linter. |
| mdlint | Markdown command line linter. |
| mysqldump-secure | Secury MySQL database backup tool with encryption. |
| nodejs | Node.js is an open-source, cross-platform JavaScript run-time environment for executing JavaScript code server-side. |
| npm | npm is a package manager for the JavaScript programming language. |
| phalcon-devtools | CLI tool to generate code helping to develop faster and easy applications that use with Phalcon framework. |
| phpcs | PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards. |
| phpcbf | PHP Code Beautifier and Fixer. |
| photon | Photon CMS cli. |
| sass | Sass CSS compiler. |
| scss-lint | Sass/CSS command line linter. |
| symfony installer | This is the official installer to start new projects based on the Symfony full-stack framework. |
| tig | Text-mode Interface for Git. |
| webpack | A bundler for javascript and friends. |
| wp-cli | WP-CLI is the command-line interface for WordPress. |
| yamllint | Yaml command line linter. |
| yarn | Fast, reliable and secure dependency management. |