gpt4 book ai didi

cakephp SplFileInfo::openFile myapp_cake_core_cake_console 无法打开流:权限被拒绝

转载 作者:行者123 更新时间:2023-12-04 14:36:27 25 4
gpt4 key购买 nike

我已经在一个网站上工作了大约一个月,最近我尝试烘焙一些东西,现在我真的被刚刚弹出的缓存权限问题困住了。例如,我已经阅读了有关此问题的 stackoverflow 上的所有内容:

SplFileInfo::openFile(/app/tmp/cache/persistent/cake_core_cake_console_):failed to open stream:Permission denied in /lib/.../FileEngine.php line 293

Cakephp Permission denied Fileengine.php

包括错误/非错误:http://cakephp.lighthouseapp.com/projects/42648/tickets/2172

但我仍然无法阻止此错误在使用 HTML->script 帮助程序加载 javascript Assets 的插件期间出现。

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

Call Stack: 0.0009 352948 1. {main}() /var/www/2tli/app/webroot/index.php:0

0.0045     446644   2. include('/var/www/2tli/lib/Cake/bootstrap.php') /var/www/2tli/app/webroot/index.php:92

0.0327 1174292 3. Configure::bootstrap() /var/www/2tli/lib/Cake/bootstrap.php:171

0.0427 1406772 4. include('/var/www/2tli/app/Config/core.php') /var/www/2tli/lib/Cake/Core/Configure.php:78

0.0494 1512200 5. Cache::config() /var/www/2tli/app/Config/core.php:336

0.0495 1512940 6. Cache::_buildEngine() /var/www/2tli/lib/Cake/Cache/Cache.php:136

0.0562 1635708 7. FileEngine->gc() /var/www/2tli/lib/Cake/Cache/Cache.php:169

0.0562 1635796 8. FileEngine->clear() /var/www/2tli/lib/Cake/Cache/Engine/FileEngine.php:102

0.0617 1637516 9. FileEngine->_setKey() /var/www/2tli/lib/Cake/Cache/Engine/FileEngine.php:236

0.0627 1657060 10. trigger_error() /var/www/2tli/lib/Cake/Cache/Engine/FileEngine.php:314

我正在运行 PHP 5.3.10。蛋糕 2.3.7。我的 bootstrap.php 中有以下内容:

// Setup a 'default' cache configuration for use in the application.
Cache::config('default', array('engine' => 'File', 'mask' => 0666));

在 core.php 中:

/**  
* Configure the cache used for general framework caching. Path information,
* object listings, and translation cache files are stored with this configuration.
*/
Cache::config('_cake_core_', array(
'engine' => $engine,
'prefix' => $prefix . 'cake_core_',
'path' => CACHE . 'persistent' . DS,
'serialize' => ($engine === 'File'),
'duration' => $duration,
'mask'=>0666 ));

Cache::config('_cake_model_', array(
'engine' => $engine,
'prefix' => $prefix.'cake_model_',
'path' => CACHE . 'models' . DS,
'serialize' => ($engine === 'File'),
'duration' => $duration,
'mask' => 0666
));

我的插件还有一个 bootstrap.php:

Cache::config('UserPlugin', array(
'engine' => 'File',
'duration'=> '+3 months',
'path' => CACHE,
'prefix' => 'UserPlugin_',
'mask'=>0666
));

我已经将所有 app/tmp 文件和文件夹作为我的 apache 所有者 www-data 并设置为 777(我也尝试了 666 来匹配掩码)。

我也删除并重建了 app/tmp 目录。

有没有人有什么想法?

编辑:我不太清楚该怎么做,但我注意到注释掉 Html->script 助手有时不会消除错误(并且原始 html 仍然显示脚本的包含)。所以我开始删除缓存并将缓存持续时间设置为 1 秒。它只是偶尔会按预期运行,因为 html 似乎已缓存。我发现始终如一地使其按预期工作的唯一方法(无论是在线评论还是在线评论时)是删除缓存并重新启动浏览器(firefox)。然后,每当我在重新启动 firefox 后再次放入 html->script 时,cake 就会在没有权限错误的情况下工作。我确信问题会再次出现,因为我似乎找不到根本原因。

最佳答案

我发现 Bake 这样做的问题是我的持久缓存中的文件的权限受到限制。这意味着我的网站创建了它们(www-data)并且没有为我的控制台应用程序提供完整的读/写/执行权限来使用该文件。

我通过更改持久文件夹中文件的权限来解决这个问题

cd ./app/tmp/cache/persistent/
sudo chmod 777 *

我必须使用 sudo,因为我不是文件的所有者;网站 (www-data) 是。

希望这对某人有帮助。

关于cakephp SplFileInfo::openFile myapp_cake_core_cake_console 无法打开流:权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18346337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com