The following code works on my development environment (Ubuntu 14.04 desktop)
@if(env('APP_ENV') === 'production')
// ... something
But for some reason, the blade views on production (ubuntu 14.04 server) aren't getting the env variables.
If I run php artisan env
the response is just fine: Current application environment: production
The database connection works fine. And the env() helper called from the controllers, also works.
What I tried so far:
php artisan clear:cache
php artisan config:cache
php artisan clear:cache
php artisan view:clear
I also restarted apache multiple times, no results.
Any advice? Thanks!
So, I made it work.
php artisan config:clear
did the trick.
php artisan config:clear
php artisan cache:clear
service apache2 restart
(just in case)What I guess the problem was:
The first time I run php artisan config:cache
my .env file had APP_ENV=local. So I had to clear that config cache in order to get the new env vars values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With