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

配置UVDesk测试服务器时遇RuntimeException:无法写入cache目录

UVDesk配置报错:无法写入cache目录

错误信息

英文原文:Unable to write in the "cache" directory at Symfony\Component\HttpKernel\Kernel->buildContainer()
中文翻译:无法写入"cache"目录,错误触发于Symfony\Component\HttpKernel\Kernel类的buildContainer()方法

相关源码片段

protected function buildContainer()
{
    foreach (['cache' => $this->getCacheDir(), 'build' => $this->warmupDir ?: $this->getBuildDir(), 'logs' => $this->getLogDir()] as $name => $dir) {
        if (!is_dir($dir)) {
            if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
                throw new \RuntimeException(sprintf('Unable to create the "%s" directory (%s).', $name, $dir));
            }
        } elseif (!is_writable($dir)) {
            throw new \RuntimeException(sprintf('Unable to write in the "%s" directory (%s).', $name, $dir));
        }
    }
}

解决步骤

  • 定位UVDesk项目的cache目录,默认路径为var/cache
  • 检查目录权限:
    • 测试环境快速修复:执行命令 chmod -R 777 var/cache
    • 生产环境安全配置:将目录所有者改为服务器运行用户(如www-data),执行 chown -R www-data:www-data var/cache,再设置权限为 chmod -R 755 var/cache
  • 若cache目录不存在,手动创建:mkdir -p var/cache后再设置上述权限
  • 重启PHP服务或刷新页面,验证问题是否解决

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 08:36:08