laravel No supported encrypter found. The cipher a

2019-01-07 06:33发布

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 error:

RuntimeException in EncryptionServiceProvider.php line 29:
No supported encrypter found. The cipher and / or key length are invalid
in EncryptionServiceProvider.php line 29
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array()) in Container.php line 733
at Container->build(object(Closure), array()) in Container.php line 626
at Container->make('encrypter', array()) in Application.php line 674
at Application->make('Illuminate\Contracts\Encryption\Encrypter') in Container.php line 837
at Container->resolveClass(object(ReflectionParameter)) in Container.php line 800
at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 771
at Container->build('SahraSalon\Http\Middleware\EncryptCookies', array()) in Container.php line 626
at Container->make('SahraSalon\Http\Middleware\EncryptCookies', array()) in Application.php line 674
at Application->make('SahraSalon\Http\Middleware\EncryptCookies') in Pipeline.php line 123
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 118
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 86
at Kernel->handle(object(Request)) in index.php line 54

Can anyone help solve this error?

14条回答
相关推荐>>
2楼-- · 2019-01-07 07:05

I managed to solve deployment to live Ubuntu server, here is all the steps

Ensure PHP >= 5.5.9

Ensure, OpenSSL, Mbstring, Tokenizer and mcrypt is installed.

To Install mcrypt in PHP (Ubuntu):

sudo apt-get install php5-mcrypt,
sudo php5enmod mcrypt

Make storage folder writable:

chmod -R 0777 storage

Make Apache use the Lavarel /public folder as home:

DocumentRoot /home/code2/public_html/Laravel-Project/public
    <Directory "/home/code2/public_html/Laravel-Project/public”> 
         AllowOverride all 
    </Directory>

Major gotcha for me is FTP might not copy hidden files by default: .env and /public/.htaccess need to be there!

After completing the tasks above, it worked on Ubuntu server

查看更多
看我几分像从前
3楼-- · 2019-01-07 07:07

Do you have all the necessary extensions installed on the server?

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

It could be that you're missing the OpenSSL extension. Also, do you have the key set in .env file?


Try running:

php artisan key:generate


Answer: the 'cipher' => '' was not set.

查看更多
登录 后发表回答