Whoops, looks like something went wrong. on server - laravel

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.

Related

Laravel can't access database

I cvurrently have a laravel application running on heroku, the issue here is, I keep getting the error that I can't connect to the database: SQLSTATE[HY000] [1045] Access denied for user 'user'#'ec2-54-74-209-179.eu-west-1.compute.amazonaws.com' (using password: YES). Now the host is wrong here, the environment files are TOTALLY different (except for the username) then what the error gives....
How can I resolve this issue?
I've tried to use the DB_URL env, but that gives the same result...
Did you set the .env correctly on what's running on their server?
You can see all your projects in laravel at TOOLS->DEPLOYEMNT->CONFIGURATIONS
add all the info and connect to the remote project. I did the same and changed the .env directly there.
and of course you have to clean all the cache cause even if you change the .env it will not work until you'll clear it
php artisan cache:clear;
php artisan config:clear;
php artisan route:clear;
Obviously this need to be executed on the project on heroku or aws (as it appears from the Error)

Laravel Local Routes on server after deployment

My problem is that i tried to upload my project to the server (using filezilla uploaded the whole thing) and encountered this error:
"The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths."
Searching on google, people says its a key problem on .env file. But that wasn't my case. the Key is there, I even use php artisan key:generate. it's like the server isn't reading the .env file
I tried config:cache and uploaded the "config.php" that was generated inside the cache folder and now the app cant finds the "views" because the paths are not the server paths but the local ones.
I tried everything, even uploading a fresh laravel installation and again: "The only supported ciphers are AES-128-CBC.."
Also tried config:cache on the server using the routes:
Route::get('/config-cache', function() { $exitCode = Artisan::call('config:cache'); return 'done.'; });
But i get this error: "putenv() has been disabled for security reasons"
I don't really know how to proceed..
You are getting this error because you have to generate key
try
php artisan key:generate
Or generate locally then replace it with .env
APP_KEY=YourGeneratedKey

Laravel 5.4 Token Mismatch Exception on live server

I am facing Token mismatch exception in Laravel 5.4 on live server. On my local machine running Windows XAMPP, the application works fine. When I deployed it to live machine running CENTOS 7 and LAMP stack, I see a redirecting to myhostname.com/login at the top left corner of the browser and then lands on an error page showing:
token mismatch exception on line 68 of VerifyCsrfToken.php.
I had this same problem and what i did was:
First in your .env file remove: SESSION_DOMAIN
And in set session driver like: SESSION_DRIVER=file (if your want it to save to a file)
then do: php artisan cache:clear
then `php artisan config:clear
that worked for me.
Try to clear config cache on the server with :
artisan cache:config
You will need to clear config cache also if you edited config/app.php for some reason.
In addition there is an other possible reason : you copied not only the application but also the cache/session files when you deployed your application to production. Basically everything in the storage folder should be ignored on deployment.
Run this command
php artisan config:clear
Verify .env file
delete current .env file and create new .env file from .env.example
verify that config/session.php has is correct or not modified.
You can check the file permission as well of storage directory

Laravel uploading to Heroku

Hello guys so I uploaded my app to Heroku. I want to mention that when I run php artisan:serve it all works fine without any problem but when I upload it to the heroku server I have a problem with the following error
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
Now I had the same error localy but I fixed it. now I can't seem to find how to fix it when I the app is uploaded. Any help would be appriciated. Thank you.
You need a key in your .env
php artisan key:generate
And make sure .env exists
As #EddyTheDove mentioned,
php artisan key:generate
This makes sure that the APP_KEY variable is set in the .env file. When you open the .env file, you should see the same key that was generated after you executed the command.
And make sure .env exists
This is located in your project folder.
ALSO:
Remember to use the ENTIRE key.
The "base64:" part of the generated key is also important, because it encodes the random string and provides an encryption key of the required length.

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