Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Fix support for the LARAVEL_STORAGE_PATH env var (#51238) #51243

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

dunglas
Copy link
Contributor

@dunglas dunglas commented Apr 29, 2024

#48115 introduced a convenient environment variable to configure the storage path.

However, by default, PHP doesn't populate the $_ENV superglobal in dev and production mode: https://github.com/php/php-src/blob/ed916214c478da36d473d425ca30e2ce7c310e87/php.ini-production#L159-L160

On the other hand, environment variables are always populated in the $_SERVER superglobal (https://www.php.net/manual/en/ini.core.php#ini.variables-order).

For its part https://github.com/vlucas/phpdotenv populates both $_SERVER and $_ENV.

This patch switches from $_ENV to $_SERVER, which will help using Laravel in containerized environments, where .env files aren't used in production.

@dunglas dunglas changed the title Fix support for the LARAVEL_STORAGE_PATH env var (#51238) [10.x] Fix support for the LARAVEL_STORAGE_PATH env var (#51238) Apr 29, 2024
@taylorotwell taylorotwell merged commit 0bafaa8 into laravel:10.x Apr 29, 2024
24 checks passed
@dunglas dunglas deleted the fix/env-var branch April 29, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants