Home >PHP Framework >Laravel >How to solve laravel key error problem
Solution to the laravel key error problem: 1. Modify the php.ini configuration and increase the memory_limit value; 2. Remove the previous default PHP version; 3. Update composer.
The operating environment of this article: Windows 7 system, laravel version 5.7, DELL G3 computer.
How to solve the problem of laravel key error?
Detailed problem description:
Laravel: php artisan key:generate three error solutions, modify the default PHP version (Pagoda panel)
Laravel is a simple and elegant PHP Web development framework (PHP Web Framework). The documentation is complete, the community is active, and the later support is good.
In order to be compatible with N multiple websites, there are 3 PHP versions 5.3/5.6/7.2 on the server. Pagoda defaults to 5.3, but laravel 5.7 does not support it, so an error was reported when creating the online .env environment configuration file and initializing the application configuration.
cp .env.example .env php artisan key:generate
Error 1: The PHP script takes up too much memory, and the default memory_limit of 128m is not enough.
PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted.
Composer command failed:
Composer internally increases memory_limit to 1.5G.
Solution: Modify the php.ini configuration and change the memory_limit to a larger value;
Error 2 : PHP version problem.
PHP Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in XXXXXX.
Solution: Remove the previous default PHP version
rm -f /usr/bin/php
Quote the desired version 7.2 as an example
ln -sf /www/server/php/72/bin/php /usr/bin/php
Error 3: Composer needs to be updated.
PHP Warning: require(XXXX/autoload.php) : failed to open stream: Nosuch file or directory in XXXX.
Solution: Update composer
composer update
The problem is solved OK.
Recommended learning tutorials: "laravel" "The latest five Laravel video tutorials"
The above is the detailed content of How to solve laravel key error problem. For more information, please follow other related articles on the PHP Chinese website!