Home  >  Article  >  Backend Development  >  Solution to No supported encrypter found error when using laravel 5.1

Solution to No supported encrypter found error when using laravel 5.1

怪我咯
怪我咯Original
2017-06-16 10:30:101611browse

This article mainly introduces you to the relevant information about solving the laravel 5.1 error: No supported encrypter found. The introduction in the article is very detailed and has a certain reference and learning value for everyone. Friends who need it can refer to it. Let’s join together. Let's see.

This article mainly introduces the method to solve the laravel 5.1 error: No supported encrypter found. It is shared for your reference and learning. Let’s take a look at the detailed introduction:

Problem description

When using laravel5.1 for project development, the error message "No supported encrypter found. The cipher and/or key length are invalid." appeared, resulting in the page unable to display.

Most of the answers on the Internet are to directly execute PHP artisan key:generate. Some people find it works, and some don't.

Solution

The first step to solve this problem is to look at the cipher value in config/app.php:

1. If the value of cipher is AES-256-CBC, then it can be solved by generating a new key and then restarting nginx and php-fpm. The new key generated at this time will be written directly into the .env file.

2. But if the cipher is another value, such as rijndael-256, you need to install and start the mcrypt module. The reason why AES-256-CBC is not needed is because the underlying layer corresponding to the AES-256-CBC algorithm is implemented using openssl and has nothing to do with mcrypt. rijndael-256 relies on the mcrypt module.

Check whether mcrypt is installed. The method can be to execute php -r "print_r(mcrypt_list_algorithms());"whether there is an output result, or to check the phpinfo()information.

Start the mcrypt module if it is already installed.

The method is to execute: php5enmod mcrypt

Finally restart nginx and php-fpm

The above is the detailed content of Solution to No supported encrypter found error when using laravel 5.1. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn