Skip to content

Environment variables ignored by php-fpm #74

@mikehaertl

Description

@mikehaertl

If you use the php-fpm variant, environment variables (e.g. for linked docker hosts) are not available in your $_ENV var in your PHP scripts. This is a problem as usually docker containers are configured via environment variables (following the 12 factor principles). While this is rather a PHP problem, I still think that the official php-fpm image should provide a workaround for this, as otherwhise it's pretty much useless.

For php-fpm all environment variables have to be listed in the php-fpm.conf like:

[www]
env[MY_ENV_VAR_1] = 'value1'
env[MY_ENV_VAR_2] = 'value2'

So I suggest to create a wrapper script to first add all variables from env to the configuration, before actually starting php.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions