Question: I've uploaded my Laravel app to a cpanel host . 
The problem is that Laravel does not read the contents of the .env file and show me a "Whoops, looks like something went wrong." page ( twice In one page )
This error is displayed because the program can not receive the APP\_KEY variable . can not read .env file at all . I searched a little for this problem, but the solutions did not work . I tried all these:

* 'php artisan cache:clear' command
* 'php artisan config:clear' command
* 'php artisan config:cache' command
* change permission for .env file (755)
* run all 'composer update' , 'composer install' , 'composer dump-autoload' commands
* I did not use env function anywhere
* There are no spaces in the values stored in the env file

But none of the above did not work out.
However, My program runs well in local ( windows ) and there is no problem But it does not run on the server ( cpanel )

note : I realized that when I execute the 'php artisan config:cache' command on server , all cache files are made in 'bootstrap/cache' folder, except for the config.php file
note2 : I uploaded several times in different ways. Once all the files in the folder in the root and the public files in the public\_html folder . and once all the files in the public\_html folder. Both not working

Does anyone know where the problem is?

[in this time i put all my app files in public\_html folder](https://i.stack.imgur.com/W4Udn.jpg)

Answer: 
You should not use .env file for production, it is only for development purpose.

Create environment variables for your production(on server not .env).
That always happens to me on new sites, so I usually run:

```
chmod 777 storage/ storage/app/ storage/framework/ storage/logs/
chmod 777 storage/ storage/app/ storage/framework/ storage/logs/
chmod 777 storage/framework/cache/ storage/framework/sessions/ storage/framework/views/
chmod 777 bootstrap/cache/
chmod 777 bootstrap/cache/*
chmod 777 storage/logs/laravel.log

```

Note: The last one (laravel.log) does not exist the first time, bun then it is created.

Instead of 777 you could use a more recommended ug+rwx if you first run:
 chgrp -R www-data storage bootstrap/cache
 chgrp -R www-data storage storage

where www-data is the web server user, it could be apache or httpd