PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.
FastCGI is a way of having server scripts execute time-consuming code just once instead of every time the script is loaded, reducing overhead.
5.6 (available for compatibility, no longer officially supported)
7.0 (available for compatibility, no longer officially supported)
7.2 (available for compatibility, no longer officially supported)
All PHP versions use their own Dockerfiles.
This image is prepared to be used on Lagoon. There are therefore some things are already done:
Folder permissions are automatically adapted with
fix-permissions, so this image will work with a random user.
/usr/local/etc/php-fpm.conf, plus all files within
/usr/local/etc/php-fpm.d/ , are parsed through
envplate with a container-entrypoint.
See the Dockerfile for installed
To install further extensions, extend your Dockerfile from this image. Install extensions according to the docs, under the heading How to install more PHP extensions.
PHP config contains sensible values that will make the creation of
PHP pools config easier. Here is a list of some of these. Check
/usr/local/etc/php-fpm.conf for all of them:
For handling big PHP projects.
For big PHP projects (changeable via
For big PHP projects.
For faster PHP.
For sensible production values (changeable via
For big file uploads.
php-fpm error logging happens in
💡 If you don't like any of these configs, you have three possibilities:
If they are changeable via environment variables, use environment variables (this is the preferred method, see table of environment variables below).
Create your own
fpm-pool config and set via
Learn more about them in
this documentation for Running PHP as an Apache module. This documentation refers to Apache, but it is also the case for
If you want to provide your own
php-fpm pool, overwrite the file
/usr/local/etc/php-fpm.d/www.conf with your own config, or rename this file if you want it to have another name. If you don't do that, the provided pool will be started!
PHP values with the
PHP_INI_SYSTEM changeable mode cannot be changed via an
fpm-pool config. They need to be changed either via already provided environment variables or:
Provide your own
php-fpm.conf file (this is the least preferred method).
This image is shipped with an
fpm-pool config (
php-fpm.d/www.conf) that creates an
fpm-pool and listens on port 9000. This is because we try to provide an image which already covers most needs for PHP, so you don't need to create your own. You are welcome to do so if you like, though!
Here a short description of what this file does:
Listens on port 9000 via IPv4 and IPv6.
Uses the pm
dynamic and creates between 2-50 children.
php-fpm pool children after 500 requests to prevent memory leaks.
pong when making a fastcgi request to
/ping (good for automated testing to check if the pool started).
catch_workers_output = yes to see PHP errors.
clear_env = no to be able to inject PHP environment variables via regular Docker environment variables.
Environment variables are meant to contain common information for the PHP container.
Enable NewRelic performance monitoring, needs
NewRelic license to be used, Important:
Can be set to 0 to disable APC. See php.net.
The size of each shared memory segment given. See php.net.
This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user. See php.net.
The desired logging level you'd like PHP to use. See php.net.
The the maximum number of child processes. See php.net.
The number of requests each child process should execute before re-spawning. See php.net.
The desired maximum number of idle server processes. See php.net.
The desired minimum number of idle server processes. See php.net.
The number of seconds after which an idle process will be killed. See php.net.
The number of child processes created on startup. See php.net.
Maximum execution time of each script, in seconds. See php.net.
The maximum number of files allowed to be uploaded simultaneously. See php.net.
How many input variables will be accepted. See php.net.
Maximum amount of memory a script may consume. See php.net.
Used to enable