Solution to php artisan error: 1. Clean up the compiled files; 2. Use scriptless composer update and force overwrite the previous compiled content; 3. Directly delete the vendor directory and "composer.lock ".
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
php artisan command reports an error, no matter what command is entered?
There are the following situations:
#There is a problem with the code that must be loaded before your service provider and other frameworks run, and it is interrupted when executing optimize
There is a problem with the package updated using composer update
During composer update, the update is interrupted under various circumstances and the dependencies are incomplete
artisan clear-compield was not run before composer update, resulting in the old compiled files not being cleared
optimize will write compiled.php and For map files such as service.json, check the folder permissions
If you are using Windows, 5 can be ignored, 4 is the most likely
What are the recommendations? Group solution:
How to clean compiled files
php artisan clear-compiled // 或者把上一句配置到 composer.json 中的 pre-update-cmd 以防后面又出现问题
composer update
Use scriptless composer updates and force overwriting of previous compilation content
composer clearcache
composer update --no-scripts
php artisan optimize --force
a little violence
If there are still problems, just delete the vendor directory and composer.lock, use composer install --no-scripts to reinstall, remember to run php artisan optimize --force
PHP Video Tutorial"
The above is the detailed content of What should I do if php artisan reports an error?. For more information, please follow other related articles on the PHP Chinese website!