Have you tried caching the config (artisan config:cache)? Once cached, laravel will no longer read from .env and will read from the cache instead. If you make any changes to .env you'd have to clear the cache (artisan config:clear)
Problem with .env when using multiple Laravel sites in a same apache Server
- Laravel Version: 5.2
- PHP Version: 5.6.30
- Database Driver & Version: mysql
Description:
From this I see init constructor of Dotenv and use load() function, So, all keys of .env file will set to immutable. Please check this from Loader of Dotenv. When environment variable is immutable and it was existed we will ignore it.
My Problem:
When setup multiple Laravel sites in a same Apache server. In same request, they can read env value of each others (same request mean we access to A site from browser, A site make a http request to B site (using curl) and A site display response of B site to web browser).
I think the main reason related to putenv of Dotenv Please check this Php putenv ref
I can bypass this issue by changing here, from load() function to overload() function to make variable become mutable. But I don't think this is safe solution.
Anybody meet the same situation? Please give me an advise! Thanks
Please or to participate in this conversation.