RuntimeException:无法创建缓存目录(/var/www/sonata/app/cache/dev) [英] RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

查看:114
本文介绍了RuntimeException:无法创建缓存目录(/var/www/sonata/app/cache/dev)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 Sonata管理员捆绑包.
安装后,刷新页面后出现缓存问题,然后使用以下命令删除缓存:

I installed the Sonata admin bundle.
After installation i refresh my page there is the cache problem then i use the following command to remove the cache:

rm -rf app/cache app/log

然后我重新创建目录:

mkdir app/cache app/log

但是我遇到了以下错误:

But I got the following error:

运行时异常:无法创建缓存目录(/var/www/sonata/app/cache/dev).

Runtime Exception : Unable to create the cache directory (/var/www/sonata/app/cache/dev).

推荐答案

它看起来像文件/目录权限问题.该目录必须可由Web服务器写入.创建目录后,应使用

It looks like a file/directory permission problem. The directory has to be writeable by the webserver. After creating the directory you should adjust the permissions with

chown -R www-data:www-data app/cache
chown -R www-data:www-data app/log

或者对于 Symfony 4 + :

chown -R www-data:www-data var

这仅适用于linux系统.用户和组取决于您的分布.在 Debian Ubuntu 上,它应该是www-data,在 CentOS 上,它是afaik apache.

This only works on linux systems. The user and group depends on your distribution. On Debian and Ubuntu this should be www-data, on CentOS it's afaik apache.

另一种解决方案是不删除整个文件夹,而仅通过以下方式删除它们的内容

Another solution would be not to delete the whole folders but only their contents via

$ rm -rf app/log/* app/cache/*

但是请谨慎使用此命令.

But please be careful with this command.

这篇关于RuntimeException:无法创建缓存目录(/var/www/sonata/app/cache/dev)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆