SplFileInfo :: openFile(/ app / tmp / cache / persistent / cake_core_cake_console _):无法打开流:Permission denied in /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

查看:308
本文介绍了SplFileInfo :: openFile(/ app / tmp / cache / persistent / cake_core_cake_console _):无法打开流:Permission denied in /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/票/ 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 ?或者你有任何根cron作业调用Cake shell脚本?

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

Personaly我现在有习惯 chmod 使用 cake 脚本后,整个tmp文件夹内容回到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 _):无法打开流:Permission denied in /lib/.../FileEngine.php line 293的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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