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

前端 未结 14 584
后悔当初
后悔当初 2020-11-29 19:58

I am building a project using Laravel. It was working fine on localhost, but when I upload it to the server (the server has comodo ssl installed), I receive the following er

相关标签:
14条回答
  • 2020-11-29 20:48

    I was suffering with this problem for a few too many hours before I discovered that the key was being cached in the bootstrap\cache\config.php. Deleted the file and my site loaded fine (i.e. there was otherwise no problem with my config).

    I discovered this by adding some debug output to boostrap\cache\compiled.php to make it spit out the cipher and key (somewhere around line 7010). Then dug around to see how it was picking up the config and found it uses a cache config file.

    0 讨论(0)
  • 2020-11-29 20:50

    I have same issue before and I fixed it follow this way: Go to config/app.php, change "cipher" => "anything" to

    'cipher' => MCRYPT_RIJNDAEL_128,
    
    0 讨论(0)
  • 2020-11-29 20:51

    Add "illuminate/html": "~5.0" to require section of your composer.json file. Just like this:

    ...
    "require": {
        ...
        "illuminate/html": "~5.0"
        ...
    },
    ...
    

    Then run composer install command. When composer install gets complete. run php artisan key:generate. You will get a message like this:

    Application key [get 32 char key] set successfully.
    
    0 讨论(0)
  • 2020-11-29 20:52

    solved with:

    php artisan key:generate

    0 讨论(0)
  • 2020-11-29 20:53

    I fixed it by running this:

    php artisan config:cache
    
    0 讨论(0)
  • 2020-11-29 20:56

    In my case, I need to enable mcrypt extension.

    But first, check if you already have it:

    $ sudo apt-get install -y mcrypt php5-mcrypt
    

    Check if mcrypt module is loaded:

    $ php -m | grep mcrypt
    

    if nothing shows, is because is not loaded, but you already have installed above right? So do this:

    $ php5enmod mcrypt
    $ sudo service apache2 restart
    

    Check again and you should see mcrypt instead of nothing. Thats a good sign, reload you app and go fix your next error ;)

    $ php -m | grep mcrypt
    mcrypt
    
    0 讨论(0)
提交回复
热议问题