There is no problem not worth solving, and no technology not worth learning!

Troubleshooting is always running in Laravel 6 (PHP will make a fatal error due to duplicate definitions of functions)

再一次出现了任务队列一直运行中的情况。报错:PHP Fatal error: Cannot redeclare settingUrl() (previously declared in

1. Reference: In Linux and Laravel 6, the task queue is always running for troubleshooting and analysis (timeout time has been set):https://www.shuijingwanwq.com/2022/11/10/7139/. The previous reason was that the command line did not return 1 when Artisan::Call was executed, which caused the judgment to be invalid.

2. But after the solution, the task queue has been running again and again. Error: php fatal error: cannot redoclare settingURL() (previously declared in E:\WWRoot\Object\Modules\ThemeStoreDB\Resources\Set ting_migrations\v2.0.23\migrate_settings_data.php:31) In E:\WWWRoot\Object\Modules\ThemeStoreDB\Resources\Setting_Migrations\v2.0.23\Migrate_Cart.php on line 40. as shown in Figure 1

再一次出现了任务队列一直运行中的情况。报错:PHP Fatal error: Cannot redeclare settingUrl() (previously declared in
Figure 1

[2022-11-09 16:25:33][x4FpSm3puIKqXniqIAPDSVClo3G8QLNm] Processing: Modules\ThemeStoreDB\Jobs\ThemeInstallationJob
PHP Fatal error:  Cannot redeclare settingUrl() (previously declared in E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_settings_data.php:31) in E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_cart.php on line 40

   Symfony\Component\Debug\Exception\FatalErrorException  : Cannot redeclare settingUrl() (previously declared in E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_settings_data.php:31)

  at E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_cart.php:40
    36|         }
    37|     }
    38| }
    39|
  > 40| function settingUrl($url)
    41| {
    42|     if (is_null($url)) {
    43|         return null;
    44|     }


   Whoops\Exception\ErrorException  : Cannot redeclare settingUrl() (previously declared in E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_settings_data.php:31)

  at E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_cart.php:40
    36|         }
    37|     }
    38| }
    39|
  > 40| function settingUrl($url)
    41| {
    42|     if (is_null($url)) {
    43|         return null;
    44|     }

  Exception trace:

  1   Whoops\Run::handleError("Cannot redeclare settingUrl() (previously declared in E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_settings_data.php:31)", "E:\wwwroot\object\Modules\ThemeStoreDB\Resources\setting_migrations\v2.0.23\migrate_cart.php")
      E:\wwwroot\object\vendor\filp\whoops\src\Whoops\Run.php:486

  2   Whoops\Run::handleShutdown()
      [internal]:0


3. The reason for PHP fatal error is that in the file contained in the include, due to the duplicate definition of the function, php will issue a fatal error (fatal error).

4. The final solution to the temporary solution is to modify the functions of the included files to different names to avoid this problem.

PHP / Laravel / Yii2 Legacy Project Maintenance & Long-Term Technical Support

If your PHP / Laravel / Yii2 project is already in production but needs bug fixing, API troubleshooting, performance optimization, developer handover support, or long-term maintenance, feel free to contact me for remote technical support.

Ideal For:
✅ PHP legacy systems without active maintenance
✅ Laravel / Yii2 project bug fixes
✅ Admin panel feature iterations
✅ RESTful API troubleshooting
✅ MySQL / Redis / Nginx performance issues
✅ Long-term remote part-time maintenance

We can start with a small task:
✅ Production error troubleshooting
✅ API issue analysis
✅ Slow query and performance bottleneck diagnosis
✅ Initial code structure review
✅ Deployment environment and log inspection

If you would like to discuss your project, please contact me and mention: PHP Maintenance Consultation.

Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.