Home > Article > Backend Development > PHP example-How to solve laravel 5.1 error: No supported encrypter found
This article mainly introduces you to the relevant information about solving laravel 5.1 error: No supported encrypter found. The introduction in the article is very detailed and has certain reference and learning value for everyone. It is needed Friends can refer to it, let’s take a look below.
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 "<a href="http://www.php.cn/wiki/1362.html" target="_blank">print</a>_r(<a href="http://www.php.cn/wiki/809.html" target="_blank">mcrypt_list_algorithms</a>());"
Whether there is an output result, or another way is to check<a href="http://www.php.cn/wiki/660.html" target="_blank">phpinfo</a>()
Information.
Start the mcrypt module if it is already installed.
The method is to execute: php5enmod mcrypt
Finally restart nginx and php-fpm
Summary
The above is the detailed content of PHP example-How to solve laravel 5.1 error: No supported encrypter found. For more information, please follow other related articles on the PHP Chinese website!