Permissions | Tags | Architectures | Versions | Flavours | Extensions | Tools | Env Vars | Volumes | Base Images
- Overview
DEBUG_ENTRYPOINT
NEW_UID
NEW_GID
TIMEZONE
DOCKER_LOGS
ENABLE_MODULES
DISABLE_MODULES
ENABLE_MAIL
FORWARD_PORTS_TO_LOCALHOST
MYSQL_BACKUP_USER
MYSQL_BACKUP_PASS
MYSQL_BACKUP_HOST
The following table gives an overview about which environment variable is available to which flavour.
Environment Variable | base |
mods |
prod |
slim |
work |
---|---|---|---|---|---|
DEBUG_ENTRYPOINT |
✓ | ✓ | ✓ | ✓ | ✓ |
NEW_UID |
✓ | ✓ | ✓ | ✓ | ✓ |
NEW_GID |
✓ | ✓ | ✓ | ✓ | ✓ |
TIMEZONE |
✓ | ✓ | ✓ | ||
DOCKER_LOGS |
✓ | ✓ | ✓ | ||
ENABLE_MODULES |
✓ | ✓ | ✓ | ||
DISABLE_MODULES |
✓ | ✓ | ✓ | ||
ENABLE_MAIL |
✓ | ✓ | ✓ | ||
FORWARD_PORTS_TO_LOCALHOST |
✓ | ✓ | ✓ | ||
MYSQL_BACKUP_USER |
✓ | ✓ | |||
MYSQL_BACKUP_PASS |
✓ | ✓ | |||
MYSQL_BACKUP_HOST |
✓ | ✓ |
This variable controls the debug level (verbosity) for the container startup. The more verbose, the more information is shown via docker logs during startup.
- Var type:
int
- Default:
0
- Allowed:
0
,1
,2
When set to 0
(default), only errors and warnings are shown.
When set to 1
, all log messages are shown.
When set to 2
, all log messages and all commands that are being executed by the entrypoint script are shown.
This variable controls the user id of the php-fpm process.
- Var type:
int
- Default:
1000
- Allowed: any valid user id (use your local users'
uid
)
Backgrund: The php-fpm docker image has a non-root user (and group) that the php-fpm process runs with. When one of your PHP scripts creates a file (cache, uploads, etc), it is being created with the user id and group id, the php-fpm process runs with. In order to make sure this is the same user id as your normal user locally on the host system, this env variable can be used to change the user id inside the container (during startup). Why can't the php-fpm process run as root? It would then create files with root permissions and as those files are actually on your host system, you would require root permission to access/edit them again.
You can read more about this topic here: Syncronize file and folder Permissions.
You want the PHP-FPM process to run with the same user id as the user on your host system.
What value should I set this to? Open up a terminal on your host system and type id -u
to find out the user id of your local user.
This variable controls the group id of the php-fpm process.
- Var type:
int
- Default:
1000
- Allowed: any valid group id (use your local users'
gid
)
Background: See the section in
NEW_UID
You want the PHP-FPM process to run with the same **group id **as the user on your host system.
What value should I set this to? Open up a terminal on your host system and type id -g
to find out the group id of your local user.
This variable sets the timezone for the container as well as for the PHP-FPM process (via php.ini directives).
- Var type:
string
- Default:
UTC
- Allowed: any valid timezone (e.g.:
Europe/Berlin
)
This variable controls whether PHP access and error logs are written to a log file inside the container or shown via docker logs.
- Var type:
bool
- Default:
1
- Allowed:
0
or1
By default (value: 1
) all Docker images are configured to output their PHP-FPM access and error logs to stdout and stderr, which means it is shown by docker logs
(or docker-compose logs
).
If you want to log into files inside the container instead, change it to 0
. The respective log files are available as Docker volumes and can be mounted to your local file system so you can cat
, tail
or grep
them for anything interesting.
Some PHP extensions are not enabled by default (e.g.: blackfire
, ioncube
, swoole
and others). See PHP modules to find out availalable modules and which are enabled/disabled by default. This variable explicitly enabled PHP modules during startup.
- Var type: comma separated
string
of modules to enable - Default: ``
- Allowed: available modules as a commaa separated string
Example:
ENABLE_MODULES=swoole
ENABLE_MODULES=swoole,psr,phalcon
The PHP-FPM images come with lots of available and default-enabled PHP modules. You might not need all of them. This variable controls which of the modules you want to disable explicitly during startup.
Note: Not all modules can be disabled, as some of them are directly compiled into PHP itself. See PHP modules to find out, which modules can be disabled.
- Var type: comma separated
string
of modules to disabled - Default: ``
- Allowed: available modules as a commaa separated string
Example:
DISABLE_MODULES=imagick
DISABLE_MODULES=imagick,xdebug
This variable controls whether Postfix (smtpd) should run and how it should behave, when your PHP code sends emails. It can be configured to intercept any outbound send emails and keep them locally, so that you do not accidentally send mails out.
- Var type:
int
- Default:
0
- Allowed:
0
,1
or2
By default (value: 0
), the Postfix service is disabled and not started locally inside the Docker container.
When set to 1
, the Postfix service is started normally with its out-of-the-box default configuration.
When set to 2
, the Postfix service is started and configured for local delivery. That means that all mails sent (even to real existing domains) are intercepted and catched locally. No email will ever leave the system. The emails are then stored in the devilbox
users' mail file locally in the container. Its directory can also be mounted to your local file system to browse the mails that have been sent.
This variable allows you to forward remote ports to 127.0.0.1
into the PHP-FPM docker container. This might be handy if you have another MySQL database container running and still want to be able to use 127.0.0.1
in your PHP configuration for the database host.
- Var type:
string
- Default: ``
- Allowed:
<local-port>:<remote-host>:<remote-port>
Note: You can forward multiple ports by comma separating the allowd forwarding string.
Forward a remote MySQL database locally to port 3307
# Remote MYSQL host/ip: mysqlhost
# Remote MYSQL port: 3306
# Local port to forward to: 3307
FORWARD_PORTS_TO_LOCALHOST=3307:mysqlhost:3306
Forward a remote MySQL and PostgreSQL locally to port 3307 and 5433
# Remote MYSQL host/ip: mysqlhost
# Remote MYSQL port: 3306
# Local port to forward to: 3307
# Remote PGSQL host/ip: pgsqlhost
# Remote PGSQL port: 5432
# Local port to forward to: 5433
FORWARD_PORTS_TO_LOCALHOST=3307:mysqlhost:3306, 5433:pgsqlhost:5432
You can just type mysqldump-secure
inside the PHP-FPM container to easily backup your MySQL databases with one command. (See project: https://mysqldump-secure.org/).
In order to do so, you will need to pass a MySQL user to the PHP-FPM container, so it can auto-configure mysqldump-secure for you.
- Var type:
string
- Default: ``
- Allowed: valid mysql user name
You can just type mysqldump-secure
inside the PHP-FPM container to easily backup your MySQL databases with one command. (See project: https://mysqldump-secure.org/).
In order to do so, you will need to pass a MySQL password to the PHP-FPM container, so it can auto-configure mysqldump-secure for you.
- Var type:
string
- Default: ``
- Allowed: valid mysql password
You can just type mysqldump-secure
inside the PHP-FPM container to easily backup your MySQL databases with one command. (See project: https://mysqldump-secure.org/).
In order to do so, you will need to pass a MySQL hostname to the PHP-FPM container, so it can auto-configure mysqldump-secure for you.
- Var type:
string
- Default: ``
- Allowed: valid hostname
Note: The hostname must be reachable from within the PHP-FPM container.