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.
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.
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 .
Maybe you could try to clear config cache:
php artisan config:clear
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