try this
php artisan cache:clear
php artisan config:clear
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In laravel 5.5 app I have created custom config variables in my config/app.php for example
return [
'PROFILE_CDN_URL' => env('CDN_URL').'uploads/profileimages/'
];
and then I am able to access the value by calling config('app.PROFILE_CDN_URL') but when in production after executing php artisan config:cache the value is printed as null.
Can anyone help please. Thanks in advance.
Do not use the env helper outside configuration files.
The whole point of caching your configuration is to not have to fetch environment variables and such. Their values will be cached.
As for why your config setting is null, we'll need some more information.
Post the actual file you created and its filename, along with the exact line where you're trying to retrieve a value from that file.
Please or to participate in this conversation.