Freakium
Freakium

Reputation: 31

Laravel variables in .env file aren't being read. Project stalls with ERR_TOO_MANY_REDIRECTS

I'm new to Laravel so I'm hoping I simply missed a step. I have been running a Laravel project using sail up with Docker and that has been running fine.

However, I recently pulled the latest changes from main and my project no longer runs. Taking a look at the Network tab in dev tools shows that it's constantly redirecting to / until the browser times out with ERR_TOO_MANY_REDIRECTS.

I have been told to run the project using php artisan serve. I've found that if I run the command php artisan config:cache beforehand then I can load the home page. However, I cannot connect to the database and trying to access anything in the .env file results in null. This includes the database connection variables.

I've been told to also run php artisan config:clear and php artisan cache:clear. This results in the above ERR_TOO_MANY_REDIRECTS.

I tried creating a fresh .env file with the provided .env.example. The project can read these variables but when I try to add a new one, run php artisan config:cache and its clear commands, I get ERR_TOO_MANY_REDIRECTS again.

If it's possible, I want to keep running the project with sail up and I think this is likely a .env file issue but I don't know how to fix this.

I'm out of ideas. Does anyone know what's going wrong? I was running with Docker and sail up just fine before. It looks like the only change to the .env file I pulled from main was two extra variables. If I revert the changes from main I can run the project just fine again.

I'm told it runs fine on Linux. I'm on a Windows machine.

Upvotes: 0

Views: 60

Answers (0)

Related Questions