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 executePHP 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 executephp -r "print_r(mcrypt_list_algorithms());"
whether there is an output result, or to check thephpinfo()
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!