Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No supported encrypter found. The cipher and / or key length are invalid. #60

Closed
seongbae-ml opened this issue Sep 28, 2015 · 12 comments
Closed
Labels

Comments

@seongbae-ml
Copy link

Hey,

I am getting following error when I browse localhost:8000:

Whoops, looks like something went wrong.

1/1
RuntimeException in compiled.php line 6784:
No supported encrypter found. The cipher and / or key length are invalid.
in compiled.php line 6784
at EncryptionServiceProvider->Illuminate\Encryption{closure}(object(Application), array()) in compiled.php line 1086
at Container->build(object(Closure), array()) in compiled.php line 1039
at Container->make('encrypter', array()) in compiled.php line 1577
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in compiled.php line 1131
at Container->resolveClass(object(ReflectionParameter)) in compiled.php line 1115
at Container->getDependencies(array(object(ReflectionParameter)), array()) in compiled.php line 1101
at Container->build('Illuminate\Cookie\Middleware\EncryptCookies', array()) in compiled.php line 1039
at Container->make('Illuminate\Cookie\Middleware\EncryptCookies', array()) in compiled.php line 1577
at Application->make('Illuminate\Cookie\Middleware\EncryptCookies') in compiled.php line 9279
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in compiled.php line 2776
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9279
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Request.php line 95
at Request->handle(object(Request), object(Closure))
at call_user_func_array(array(object(Request), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9279
at Pipeline->Illuminate\Pipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9269
at Pipeline->then(object(Closure)) in compiled.php line 2053
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2036
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/Users/sbae/Projects/laravel5-angular-material-starter/public/index.php') in server.php line 19

@jadjoubran
Copy link
Owner

Hi!

Your issue can be resolved by running:
php artisan key:generate
This will generate the APP_KEY and save it inside a .env file.

But how did you install this package? Because it usually generates it automatically

@ekvedaras
Copy link

I've got the same problem. Fallowed installation guide, but my IDE shown that constant MCRYPT_RIJNDAEL_128 was not defined :) Did not check, maybe it is fixed already or simply something went wrong during installation.

@jadjoubran
Copy link
Owner

@unxp so even with php artisan key:generate it didn't work?
You probably need to install mcrypt - follow this question
and please let me know if it works for you so I can update the docs with common issues

@GrahamCampbell
Copy link
Contributor

Likely you forgot to recache the config.

@seongbae-ml
Copy link
Author

That's weird.. I've checked that mcrypt is installed and mcrypt.so is added to php.ini. I also cleared application cache - "php artisan cache:clear" but still getting error. I will spend some more time tonight to find out what's going on.

I've noticed that APP_KEY in config/app.php has default "somerandomstring" and I've replaced it with one from .env file (one that was generated). This didn't help either.

I think it has something to do with MCRYPT_RIJNDAEL_128.

@GrahamCampbell
Copy link
Contributor

I think it has something to do with MCRYPT_RIJNDAEL_128.

No, you need to make sure the default cipher is used so that you get to use openssl instead of mcrypt.

@GrahamCampbell
Copy link
Contributor

@seongbae-ml
Copy link
Author

Thank you! Changing cipher from 'MCRYPT_RIJNDAEL_128' to 'AES-256-CBC' fixed it.

By default, you have cipher set to 'MCRYPT_RIJNDAEL_128':

https://github.com/jadjoubran/laravel5-angular-material-starter/blob/master/config/app.php#L83

@jadjoubran
Copy link
Owner

Fixed as of 2.10.1

@irfanwv
Copy link

irfanwv commented Jun 1, 2016

@jadjoubran when I run this php artisan key:generate command then also give same error

@jadjoubran
Copy link
Owner

@irfanwv Which error?
Feel free to open a new issue with detailed info
Thanks!

@akashgangrade
Copy link

akashgangrade commented Aug 3, 2018

Getting this error on artisan key: generate command

?[37;41m
?[39;49m
?[37;41m [ErrorException]
?[39;49m
?[37;41m Cannot modify header information - headers already sent by (output sta
rted ?[39;49m
?[37;41m at E:\wamp64\www\abc\abc\config\app.php:1)
?[39;49m
?[37;41m
?[39;49m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants