Skip to content

Dotenv does not overwrite values set in PHP-FPM via nginx fastcgi_param #268

Closed
@mpavey0

Description

@mpavey0

I am running a development server using PHP 7.1, PHP-FPM, nginx 1.8.0, and Dotenv 2.4.0. The nginx .conf file for my server, I eventually figured out, included a fastcgi_param directive setting the APP_ENV environment variable to dev. Consequently, even though I had a line APP_ENV=development in my .env file, which was being loaded by Dotenv, a call to getenv('APP_ENV') returned dev and not, as expected, development.

As I understand the Dotenv documentation, this is dependent on using overload() and not simply load(). However, the two behaved similarly.

This seems very similar to issue #39. Ideally it would be great to change the behavior of Dotenv (assuming this is possible). In the meantime, it would at least be helpful to note the limitation in the documentation (in the section about overwriting values).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions