Home  >  Article  >  Backend Development  >  What should I do if php artisan reports an error?

What should I do if php artisan reports an error?

藏色散人
藏色散人Original
2021-06-02 14:41:213202browse

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 ".

What should I do if php artisan reports an error?

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

# at the end ##Recommended learning: "

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!

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