Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

akc4's avatar
Level 1

.env on Forge isn't updating

I am using Laravel Forge to deploy my app's and recently I started playing with websockets.

Recently I needed to update the .env frequently and noticed that most of the time the .env was still using my old data.. I have tried php artisan config:clear & php artisan cache:clear in the Deploy Script but still same issue..

I am forced to manually enter data instead of using process.env.MIX_PUSHER_APP_CLUSTER & process.env.MIX_PUSHER_APP_KEY in my bootstrap.js

What am I doing wrong here?

0 likes
1 reply
goldeneye's avatar

You shouldn't use env() in your blades/js files. It will always cause issues. Any env() shouldn't be used in the code - always place it in config files. i.e: config/pusher.php:

return [
   'mixkey' => env('MIX_KEY'),
];

and access in your code:

config('pusher.mixkey');

Please or to participate in this conversation.