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

如何禁用CakePHP4 DebugKit生成庞大的tmp/debug_kit.sqlite文件

解决CakePHP 4.4.11中DebugKit自动生成sqlite文件的问题

方法一:完全移除DebugKit依赖

  • 通过Composer卸载DebugKit:
    composer remove cakephp/debug_kit
    
  • 删除项目内相关配置代码:
    1. 打开config/bootstrap.php,找到并删除以下加载DebugKit的代码块:
      if (Configure::read('debug')) {
          Plugin::load('DebugKit', ['bootstrap' => true]);
      }
      
    2. 检查src/Application.php的bootstrap()方法,若存在手动加载DebugKit的代码,直接删除。

方法二:仅禁用DebugKit(保留依赖)

如果不想卸载依赖,仅需禁止DebugKit运行:

  • 修改config/bootstrap.php中的DebugKit加载逻辑,强制关闭自动启动:
    // 替换原有加载代码,或直接注释掉原代码
    Plugin::load('DebugKit', ['bootstrap' => false]);
    
  • 检查config/app.php或app_local.php,若存在'DebugKit' => ['enable' => true]这类配置,将其改为false。

清理已生成的文件

完成上述操作后,直接删除tmp/debug_kit.sqlite文件即可,不会影响应用正常运行。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.21 08:57:01