I installed Laravel 5.0 properly by cloning in git, and composer install, when I ran it to browser http://localhost/laravel/public/
, it says
"Whoops, looks like something went wrong."
I did not make any changes after composer install.
Update after copy the env.example to .env this is result
RuntimeException in compiled.php line 5599: OpenSSL extension is required.
Check, which PHP version is running on your WAMP,XAMPP or LARAGAN server. It should be greater than 7.0.
.env.example
. (By using any editor like sublime, notepad++ and so on)..env
Then run your LARAVEL program. Hope it will work.
You can check whether how to change the PHP version in your current server. xampp, wamp
$app->withEloquent();
Try this:
sudo chown -R www-data pathto/.env
BECAUSE IF After Creating the .env file or/and Generating the Key by
php artisan key:generate
just as explained previously by others, and it still persists Try the following:
ls path/.env -al
if apache doesn't have access to it by displaying
www-data
as one one of the users i mean like
-rw-rwx--- 1 www-data rootuser 575 Nov 4 06:34 pathto/.env
This as stated above should resolve it. Especially when your laravel.log file keeps complaining that the key hasn't been generated or added.
sudo chown -R www-data pathto/.env
Go to project directory then follow below steps.
step 1: rename file .env.example `to .env
mv .env.example .env (for linux)
step 2: php artisan key:generate
This worked for me:
.env
file and be sure APP_DEBUG=true
.env
file) change reemplace 127.0.0.1
for localhost
for check if your DB credential are corrects. config
folder and do. the step #2.Please, try to find something like:
./website/config/app.php and set 'debug' => env('APP_DEBUG', false) as 'true' 'debug' => env('APP_DEBUG', true)
This is happening because there is a field in .env
file named, APP_KEY, which is blank now, we need some random key for this variable.
Follow these steps to get rid of this problem.
1) .env.example
to .env
2) Go to your root directory in your command prompt (If you are using windows)/terminal (If you are using MAC or LINUX) where you have installed laravel project/files and run following command
php artisan key:generate
and then run your project. It's all done.
make sure app/storage dir permission is set to 755 and owner is set to admin. and also check permission and owner of files and dir in app/storage too
I renamed the .env.example to .env and ensure
APP_ENV=local
which showed me the actual error. It was related to key. Then I issued
php artisan key:generate
command and it worked
Create a new .env
file and copy the code of .env.example
and run the command -> php artisan key:gen
In Laravel 5.5, I had the same issue
.env
was added to .gitignore.
So Either remove ".env" it from .gitignore file.
or add it forcefully
git add .env -f
And Deploy it. It will work.
If above does not help. Try generating the Key Again
php artisan key:generate
in process of uploading env
file to cpanel,
sometimes the dot is taken out and this may raised the error.
this solution worked for me.
go to your cpanel and rename
env
file to.env
Follow these steps to this problem for all versions of your laravel like laravel 5.5
Step: 1
Rename file .env.example
to .env
Step: 2
Go to your Command prompt/terminal and change path to project directory. Generate key for your application. This is unique for every application so don't make copy paste.
Just run the following command. Key will automatically save to your .env file
php artisan key:generate
Try to type in cmd: php artisan key:generate the problems will be solved
Simply type in terminal in your command prompt go to laravel directory path and type php artisan key:generate
then key will be generated. Paste that key in config/app.php
key variable. Your problem will be solved. I also did like that inorder
to solve the problem...
First run command composer install
Then check for .env.example and .env files in your project folder.
.env file is your main configuration file for database and .env.example is backup file for .env file.
.env.example file will always be there but sometimes .env file can be missing. just copy the .env.example file and paste in the same project folder with filename .env .
now run php artisan key:generate
command. this will generate key for your application.
Source: Stackoverflow.com