Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel env file is not loading

I have moved my laravel project from local to production server which is centos vps. Strange thing I'm facing is laravel can't read from .env file, And I have tested everything to make it work but no success.

I have set it's permission to 777 and it's owner to the owner of vps.

still no success.

FYI : it is in gitignore but I have created .env file on server so this problem has nothing to do with gitignore.

Can someone walk me through step by step running laravel on production server? Exactly what should be done and what commands do I need to execute, where should I put project and where should put public directory files ?

please help me out.

like image 888
Mohammad_Hosseini Avatar asked Feb 08 '17 11:02

Mohammad_Hosseini


People also ask

What is the .env file?

The . env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your . env file.

How do I change environment variables in Laravel dynamically?

A simple way to update the . env key value in laravel is to add the below code in the controller function where you want to change . env values. $key = 'VARIABLE_NAME'; $value = 'NEW VALUE'; file_put_contents(app()->environmentFilePath(), str_replace($key .


1 Answers

Maybe you could try to clear config cache:

php artisan config:clear
like image 168
rap-2-h Avatar answered Sep 21 '22 06:09

rap-2-h