• Register
0 votes

Problem :

I have recently installed a new fresh copy of laravel 5.3 using composer but I keep getting following error:

The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. Even though my app.php file in config directory specify
'cipher' => 'AES-128-CBC',

6 5 3
7,540 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

I have lots of industry experience in writing complex code.I have gone through your post and understood your problem.Please follow below approach to resolve your issue:.

To begin with you must ensure first that you have a valid .env file which you can use in the terminal by copying the existing .env.example file as following:

$ cp .env.example .env

After that you need to generate your application Key by using following command:

$ php artisan key:generate

Once this is achieved please make sure that you open your .env file and also ensure that the APP_KEY looks correct as follows:


If  observed carefully you will notice that the key length is wrong for some unknown reason maybe because of running key : generate multiple times it has two base64= keys present there. So just Removing one is the fix to your problems. I was also having and this appears to be an Artisan/Laravel bug.

Hope this answer helps you or who may be struggling with the similar problems or annoying bug

9 7 4
38,600 points
0 votes


You require to have .env on your appication folder then run:

$ php artisan key:generate

In case you don't have .env copy from .env.example:

$ cp .env.example .env

Run php artisan key:generate.

Do php artisan config:clear,

Thereafter php artisan config:cache

And things will begin performing

Run this commands on your terminal:

php artisan config:clear
php artisan config:cache

In case you are running a Laravel project for the first time in that machine ensure that you have the required requirements. Open your CMD/Terminal in your project directory or

cd to/your/project/dir

Provide this command again:

composer update

Alter your .env.example to .env and make required changes in that file particularly database configurations to avoid db error. Then

php artisan key:generate

This resolves this AES cipher key length issue each time I make a Laravel project or clone it from git.

Follow These Steps:

Step 1: Ensure that you have .env file in your application. In case not run this command cp .env.example .env

Step 2: Now run following command ( php artisan key:generate ) to produced a key and it will obtain saved in .env file automatically.

Step 3: Run php artisan config:cache in case you want to cache the configurtration Or php artisan config:clear

run this command

php artisan key:generate

and the clear config cache using

php artisan config:cache


10 6 4
31,120 points

Related questions

0 votes
1 answer 78 views
Problem: I have very recently downloaded the Graphviz 2.38 MSI version then installed it under folder C:\Python34. Next step I ran pip install Graphviz everything went well. In my system's path I have also added C:\Python34\bin. When I tried to run my ... I also tried to uninstall my Graphviz and did pip uninstall graphviz then tried reinstalling it and pip install again still nothing is working.
asked Aug 28, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 600 views
Problem : I am running Laravel 5.4 on my Homestead vagrant box but when I want to run npm run production I am getting the following error block-scoped declarations (let, const, function, class) not yet supported outside strict mode.
asked Nov 14, 2019 peterlaw 6.9k points
0 votes
1 answer 53 views
Problem : Facing migration error on Laravel 5.4 with php artisan make:auth command as follows: syntax error or access violation: 1071 specified key was too long; max key length is 767 bytes
asked Nov 13, 2019 peterlaw 6.9k points
1 vote
1 answer 29 views
Problem: I am getting an error message: windows error 2 occurred while loading the java VM I was just wondering if anyone had seen this kind of error before and if so, how to solve it. The very few answers I can find online relate to this issue. Somebody please step ahead and pull me up. Thanks
asked Mar 26, 2020 Gavin 15.3k points
0 votes
1 answer 2.3K views
Problem : I got stuck on below error I am trying to configure my SMTP mail on laravel “Expected response code 250 but got code "530", with message "530 5.7.1 authentication required "” Below is the configuration on .env MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io ... I have tried to authenticate my SMTP on the env but I keep facing the above error so for now I am stuck on that error.
asked Feb 4, 2020 jwilliam 3.9k points
0 votes
1 answer 41 views
Problem: I had installed MySQL on my linux server sometimes back now I forgot the password so I tried to change it using the ways I found online. What I did was as shown below: /etc/init.d/mysql stop mysqld_safe --skip-grant-tables & mysql --user root mysql SELECT * ... it still shows me below errors  "Access denied for user 'root'@'localhost' (using password: Yes)". How to fix above MYSql error?
asked Jul 14, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 48 views
Problem : I recently installed a Laravel 5.0 properly by cloning it in git, and composer install, but when I ran it to my browser http://localhost/laravel/public/, it gives below message : "Whoops! looks like something went wrong. please give us a few ... I tried to copy a env.example to .env below is result “RuntimeException in compiled.php line 5599: OpenSSL extension is required.”
asked Feb 3, 2020 jwilliam 3.9k points
0 votes
2 answers 785 views
Problem : Currently I am using the Python 3.3 and I have only entered these 3 below lines: import sklearn as sk import numpy as np import matplotlib.pyplot as plt But I am facing below error: “SyntaxError: multiple statements found while compiling a single statement” What is wrong with my Python code?
asked Jan 14, 2020 jwilliam 3.9k points
0 votes
1 answer 306 views
Problem : I am trying to learn the pSQL. I recently moved my Laravel App from the MySQL to pSQL. But now I keep on getting below error. “The Response content must be a string or object implementing __toString(), "boolean" given.” I have the API that was returning my promotion before but now it only returns the above error. Can anyone suggest me solution on above error ?
asked Feb 13, 2020 mphil 2.3k points