SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):无法打开流:权限被拒绝在/lib/.../FileEngine.php line 293 [英] SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):failed to open stream:Permission denied in /lib/.../FileEngine.php line 293

查看:31
本文介绍了SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):无法打开流:权限被拒绝在/lib/.../FileEngine.php line 293的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事 CakePHP 2 项目.它最初从 2.0.x 开始,然后最近迁移到 2.1.0.在整个开发过程中,我一直收到下面的错误信息.

I am working on a CakePHP 2 project. It originally started out in 2.0.x and then recently migrated to 2.1.0. Throughout the whole development process, I have been receiving the error message below.

它以不可预测的方式弹出页面顶部.可能是我只是在查看不同的页面时,甚至在我向数据库中添加了一条记录(但记录已正确保存)之后.

It pops up at the top of the page unpredictably. It can be when I am just viewing different pages, or even after I add a record to the database (yet the record properly saves).

Warning:
SplFileInfo::openFile(/var/www/cake_prj/app/tmp/cache/persistent/cake_core_cake_console_): 
failed to open stream: 
Permission denied in 
     /var/www/cake_prj/lib/Cake/Cache/Engine/FileEngine.php on line 293

我递归设置了tmp文件夹的所有者和组为apache,仍然收到消息.此外,我然后递归地为所有人设置读取、写入和执行的权限(chmod 777).错误信息仍然弹出.

I recursively set the owner and group of the tmp folder to apache, and still received the message. In addition, I then recursively set the permissions to read, write, and execute for all (chmod 777). The error message still pops up.

即使更改了所有者、组和权限后,相关文件仍然存在:

Even after changing both the owner, group, and permissions, the file in question:

cake_prj/app/tmp/cache/persistent/cake_core_cake_console_

将其所有者和组设置回 root,并将其权限设置回默认.

will have its owner and group set back to root, and its permissions set back to default.

是什么导致了这个问题?有没有办法确保每次生成这个文件时,它总是具有读/写/执行权限的 apache:apache?

What could be causing this problem? Is there a way to ensure that every time this file is generated, that it will always have be apache:apache with read/write/execute permissions?

推荐答案

有一个错误报告 http://cakephp.lighthouseapp.com/projects/42648/tickets/2172 但它被认为不是一个错误.

There was a bug report there http://cakephp.lighthouseapp.com/projects/42648/tickets/2172 but it was considered as not being a bug.

我个人注意到,当您在控制台中使用 cake 脚本时,某些文件所有者可能会被修改(例如制作 bake).修改后的文件属于您在控制台中使用的用户.

What I personaly noticed is that some file owner may be modified when you use the cake script in the console (for instance to make a bake). The modified files then belong to the user you use in the console.

这是否意味着您在 root 时调用 cake ?或者您是否有任何调用 Cake shell 脚本的 root cron 作业?

Would this mean you call cake while being root ? Or do you have any root cron job that calls a Cake shell script ?

我个人现在习惯在使用 cake 脚本后将整个 tmp 文件夹内容 chmod 返回给 apache 用户,这似乎可以防止出现警告.

Personaly I have now the habit to chmod the whole tmp folder content back to the apache user after having used the cake script and it seems to prevent the warning to appear.

这篇关于SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):无法打开流:权限被拒绝在/lib/.../FileEngine.php line 293的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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