laravel public/index.php - Whoops, looks like something went wrong - laravel

i just installed Laravel (throught composer):
OS - Windows 8;
Local Server - Open Server;
When i go to "tlaravel.loc/"i get the core folder with all directories:
If i go to http://tlaravel.loc/public/
i get 500 error and: Whoops, looks like something went wrong.
After modify rights (maked writable) for next directories:
- public
- bootstrap/cache
- storage
i resolved the problem with 500 eror, but on the page is still the error:
Whoops, looks like something went wrong.

Now you've need to run these commands:-
For generate env key-
php artisan key:generate
And after that
composer update
It'll resolve yours issue.

The Upper answer is totally right, I'll explain it better what do you have to do in order to fix this problem
In your laravel project that you've installed, you have all of these folders and files in the root directory, as you can see... there's an .env.example file in the root folder
WINDOWS... maybe other OS DOES NOT understand/recognize what the heck is that for, but they need an enviroment file in the root folder in order to get the key that allows us to open the local server.
so what we have to do is to rename that file .env.example to just .env.
after that you have to try again putting in the shell/terminal:
php artisan key:generate
and then....
composer update
after that you run your server again and it will work!!!!

Related

DigitOcean - laravel 8 deployment through Github (error 500)

I deployed the laravel app to digitalocean:
but I don't understand why is it showing error 500??
I connected a github repo to deploy it to digitalocean.
1- I set the build commands to: composer install
2- environment variables are set: APP_NAME, APP_URL, APP_KEY, DATABASE_URL, APP_DEBUG
This is how the repo looks (private)
What seems to be the issue??
I just did check the repo and it seems the vendors folder not there and your build steps look like a typo issue so please run below command
composer install
Still you face the issue then refer the laravel logs for that what went wrong
you also dont have a .env file
maybe copy the .env.example to .env
perhaps follow the instructions on the laravel site for the version you are using.
in your question, you have spelt 'install' incorrectly
turns out there were typos of lower and upper cases in controllers according to the laravel log.
I fixed them and now the site is running. It's weird that these typos didn't trigger erorrs locally..
All You have to do is configure the .env file if u have a .example.env edit the file to .env if u dont have it just try to create one or clone one from another project and do composer install but don't forget to generate a key with php artisan key:generate in the end

500 issue with Laravel

I have seen this answer in many posts but they have not helped me at all. I followed the regular steps to create the laravel project like this:
I cloned from my repository.
I ran composer update.
I added 777 permissions to storage and bootstrap folders.
I have a .env file.
I verfied the .htacces and it's ok.
It is working in locahost, but when I try to replicate it in Hostinger it does not work, it displays the 500 server error. So I wonder what is the problem?
I checked the logs by the way and they were empty. I put the laravel project debugger to true too.
the website url is xellin.com
The debug:
The logs folder:
Thanks.
I think this is a good opportunity to point out how PHP / Laravel / Underlying Server interacts one to each other.
First:
The HTTP server inspects Document Root and .htaccess to get instructions.
If the file is .php (like Laravel), then it CALLS to the php handler.
The php handler could be a FPM version or a Fast CGI version.
-> If an error ocurrs parsing the .htaccess or with the initial interaction between Http Server and PHP... Laravel never runs for real. All ends in a PHP error log
To find out what's wrong, you need to inspect what PHP / Http Server said about the error in their respective logs.
In short words: at this point is not a Laravel error, but a server/php one.
Second:
If Apache/PHP runs well, then PHP executes the Laravel Applicacion Lifecycle... if Laravel encounters a problem, then you will see the usual output error of Laravel Error Handler.
I think this is a must to know to work with web apps in general, because many times developers miss to catch if the problem was with Laravel, or with PHP / Server itself.
As a side note, that's why it is important to know how to choose propper hosting service for Laravel.
Thanks for reading.
You can try to clear cache
Like as
php artisan optimize
Or
You can manually delete cache files which is located in bootstrap folder and inside bootstrap folder you can see cache folder inside cache folder delete all files except git ignore file your issue fix
If you show again this error on live serve then tou can update your composer and then run
php artisan optimize
at first, if you give any of your folders 777 permissions, you are allowing ANYONE to read, write and execute any file in that directory.... what this means is you have given ANYONE (any hacker or malicious person in the entire world) permission to upload ANY file, virus or any other file, and THEN execute that file...so please be careful because IF YOU ARE SETTING YOUR FOLDER PERMISSIONS TO 777 YOU HAVE OPENED YOUR SERVER TO ANYONE THAT CAN FIND THAT DIRECTORY. please read the full explanation from here
the second here is the detailed steps I used to deploy my projects to the server:
run npm run production then update your github repo.
clone the project from GITHUB to server - clone to an outside folder (not public_html folder)
run cd <cloned folder name>
run composer install
run npm install
copy and configure .env file to cloned folder( be sure name is .env not env).
copy all content of cloned_project_folder_name/public to public_html folder
in index.php inside public_html folder edit as below
$app = require_once __DIR__.'/../cloned_project_folder_name/bootstrap/app.php';
require __DIR__.'/../cloned_project_folder_name/vendor/autoload.php';
set your .htaccess properly.
change permission to 755 to index.php and all file in public_html folder
run composer install --optimize-autoloader --no-dev
run php artisan config:cache
run php artisan route:cache
I think I state it all, hope that will help

Whoops, looks like something went wrong :(

I have upgraded my laravel project to 5.6 version and can't see info about the error. I only see a blank page with Whoops, looks like something went wrong: https.
Shame on me I forgot to enable debug APP_DEBUG=true
This worked for my fresh Laravel installation version 5.6
first: rename .env.example to .env or create .env file
second: Generate a key suing php artisan key:generate
third: copy the key generated and past it the .env file
ex: APP_KEY=base64:H1HZa/**********
lastly rerun php artisan serve

Whoops, looks like something went wrong. on server

I uploaded all laravel project on server, its working fine on local but getting error on server, even database configuration and key is configured in env. file. even i renamed .env.example file as .env too but got same error.
Error is
"Whoops, looks like something went wrong."
my error log is here:
[2017-11-06 15:19:07] local.ERROR: exception 'RuntimeException' with
message 'The only supported ciphers are AES-128-CBC and AES-256-CBC
with the correct key lengths.' in
/home/rndspot5/public_html/dev/lea/vendor/laravel/framework/‌​src/Illuminate/Encry‌​ption/Encrypter.php:‌​43
Judging from your error, you need to run php artisan key:generate this will update your key of which in turn will rectify your error.
You will need to either SSH into your public_html folder if you have host permission to do so. Alternatively, you can ask your host provider to either:
Grant you SSH access
Perform this action for you.
You can then run: php artisan config:clear once the new key has been generated.
If you are on shared hosting you can use these steps
Open your .env file, copy APP_KEY to somewhere else as a backup
Run php artisan key:generate from console
Copy the new APP_KEY and upload it to the .env file on your (shared) server
Move the old key back to development
I resolved this issue, by adding web app url in .env and Config/App.php and now its working :) thanks all of you for sharing such a value able knowledge that will help me, may be later.

moving Laravel project between computers

I have been working on a laravel5 project on a computer , but now I want to continue on an other, but don't know how :(
I'm using wampserver and the project is in the "www" folder, this is the error I'm getting when trying to open the project: " Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"
Your error message is very vague, so it is hard to pinpoint the cause. I assume you just copy pasted all of the project files
Try these steps:
Make sure you copy all of the project files including the hidden ones(.env).
Prepare your destination computer as in http://laravel.com/docs/
Check you have all the necessary PHP extensions available in php.ini as in above link requirements. Also, watch your PHP version!
Install composer https://getcomposer.org/doc/00-intro.md
When copied, go to your destination folder and run composer install.
Run php artisan key:generate from the command line.
Run php artisan cache:clear from command line
http://php.net/manual/en/install.windows.commandline.php
Make sure your webserver is serving pages from project/public folder.
If laravel is failing, check the log file to see the cause
your_project/storage/logs/laravel.log
Copy the project folder and navigate terminal/cmd
just run following commands.
Create database and place the same name at .env file in laravel project folder
1. composer install
2. php artisan key:generate
3. php artisan cache:clear
4. php artisan migrate
UPDATE: If you're getting
Whoops, looks like something went wrong
in app/config/app.php, set debugging as true with:
'debug' => env('APP_DEBUG', true)'
If you're getting the error
No supported encrypter found. The cipher and/or key length are invalid
for some people it worked to do cp .env.example .env before (2).
You would also have to create new storage link, because Laravel uses absolute path inside it.
php artisan storage:link
https://stackoverflow.com/a/32722141/3982831 Please follow this to resolve your problems. All people forget about permissions on folders.
After you have done as Ademord answer, you might need to use refresh to your WAMP, XAMP or any other development stack you are using. I had the same issue plus changes were not reflecting in the front end. For example new routes in the web.php were not updating.

Resources