本文介绍了Symfony 权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮我修复我收到的以下错误消息?我终于在虚拟机上安装了 Symfony,它似乎工作正常,除了我偶尔会收到类似这样的消息:

Can anyone help me fix the below error message I'm getting? I've finally got Symfony installed on a VM and it seems to be working ok except for the fact that I'm getting occasional messages for things like this:

[1/2] ContextErrorException: Warning: SessionHandler::read(): open(/var/lib/php5/sess_d8qgvn11jdu8rfuo1f0njokc67, O_RDWR) failed: Permission denied (13)

从我从阅读中了解到的,我认为这是因为我在 linux 和网络服务器之间的所有者/权限不匹配,但我不知道这会如何发生(我只是这是事实,我真的不明白如何/为什么要防止将来犯同样的错误).

From what I've picked up from reading around, I'm thinking it's because I have a mismatch between the owner/permissions between linux and the webserver but I don't know how this would happen (I'm just taking this as fact and I don't really understand how/why to prevent making the same mistakes in the future).

每次我遇到这些错误时,我都会提交以下命令的组合来尝试解决问题,但我猜这不是解决问题的正确方法(括号中的文字是我的理解/猜测他们做什么):

Each time I've been getting one of these errors I'm submitting a mix of the below commands to try and fix the problem but I'm guessing it's not the right way to go about it (text in brackets is my understanding/guessing of what they do):

sudo chmod a+x 修改目录权限

sudo chmod -R 775 除了它设置权限 -R 递归地应用它

sudo chmod -R 775 <path>Similar to previous except that it SETS the permissions -R applies it recursively

sudo chown -R :www-data 更改目录/文件的所有者/组

sudo chown -R <usr>:www-data <path>Changes the owner/group of the directory/file

推荐答案

你可以看看 http://symfony.com/doc/current/book/installation.html 在设置权限"部分.它讨论了应用程序/日志和应用程序/缓存,但您可以对任何其他需要的文件夹执行相同操作

You can take a look at http://symfony.com/doc/current/book/installation.html on "Setting up Permissions" section. It talks about app/logs and app/cache, but you can do the same on any other folder you need

这篇关于Symfony 权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 13:57