You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel 9 部署至服务器后出现Class 'config'不存在错误求助

Laravel 9 线上部署报错:Class "config" does not exist

本地运行正常的Laravel 9项目,上传至线上服务器后出现以下致命错误:

Fatal error: Uncaught ReflectionException: Class "config" does not exist in /.../vendor/laravel/framework/src/Illuminate/Container/Container.php:875 Stack trace: #0

项目未放置在服务器根目录,而是部署在子文件夹中(服务器上同时运行着另一个Laravel 8.8项目,该项目运行正常)。

已尝试的排查操作:

  • 删除vendor文件夹并重新安装依赖
  • 删除缓存文件夹内的所有文件
  • 执行命令 php artisan optimize:clear
  • 依次执行以下命令:
    composer install
    composer dump-autoload
    php artisan cache:clear
    php artisan config:clear
    
  • 使用Laravel默认配置的.env文件,无异常配置项

内容的提问来源于stack exchange,提问作者Virell

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 11:36:15