PHP-FPM Docker image with automatic configuration file creation and export
- Based on official PHP-FPM (7.x) Docker image
- Automatic configuration creates well-commented configuration files using environment variables or use configuration files at volume "/configurations"
- Installed and enabled some common extensions (gd iconv mbstring mysqli pdo pdo_mysql opcache)
- Installed and enabled some extra extensions in alpine-extras image (bcmath, bz2, imap, soap, sockets, shmop, xmlrpc, apcu, imagick, redis)
- Included ssmtp for mail relay
- alpine, latest
Environment variables supported
Enable automatic configuration file creation
Current container name
Current domain name
Smtp container hostname
Change owner of /var/www/html and some special directories (/data/opcache, /sessions, /home/www-data) recursively to "www-data:www-data".
As the default user is www-data and it is already used in PHP-FPM configuration files, this will solve PHP permission errors for development.
This also affects the directories and files at host if you mount volumes. Will also be enabled if CHANGE_UID or CHANGE_GID is set.
Change uid of default user www-data. You can make this match your current uid (id -u) on host to easily access mounted volumes for development.
Change gid of default group www-data. You can make this match your current gid (id -g) on host for development.
Automatic configuration, creates configuration files using the supported environment variables
unless they already exist at /configurations directory. These are well-commented configuration files
that you can edit according to your needs and make them persistent by mounting /configurations directory
to a location on host. If you need to re-create them using the environment variables, then you must
delete the old ones. This is all by design.
Configuration templates for extensions in alpine-extras image are not ready currently.
There is a working Docker Compose example project which you can see vkucukcakar/php-fpm image in action: lemp-stack-compose