gpt4 book ai didi

cakephp - 在 CakePHP 站点中获取 'unable to write' 错误

转载 作者:行者123 更新时间:2023-12-01 06:53:22 26 4
gpt4 key购买 nike

我有一个抛出错误的 CakePHP 站点(一开始很好,并且已经在线几个月 - 不确定问题何时开始)。

我越来越:

Warning (512): _cake_core_ cache was unable to write 'cake_dev_en-us' to Apc cache [CORE/Cake/Cache/Cache.php, line 310] Warning (512): _cake_core_ cache was unable to write 'cake_en-us' to Apc cache [CORE/Cake/Cache/Cache.php, line 310] Warning (512): _cake_model_ cache was unable to write 'default_projects' to Apc cache


[CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_projects' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_clients' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_clients' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_projectpages' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_projectpages' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_settings' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]
Warning (512): _cake_model_ cache was unable to write 'default_settings' to Apc cache [CORE/Cake/Cache/Cache.php, line 310]

我已经确保 tmp 目录是可写的(已将它以及所有包含的文件夹和文件设置为 0777;还检查了它是否正确更新,并且确实如此);我还通过将调试级别设置为 0 来关闭 core.php 中的错误报告。

大多数站点都很好,但是这个特定页面是由 AJAX 拉入的,我不知道这是否有任何区别。

我已经通过在蛋糕错误上设置“显示:无”来修补它,但我需要了解为什么会发生这种情况。首先,是什么导致了错误?其次,为什么核心设置被忽略了?

最佳答案

在 Zend Server 7 上运行 CakePHP 站点时,我遇到了这个 APC 缓存错误。不幸的是,Zend Server 似乎附带了 假/替代 APC 层,根据我的测试,变量数据存储不起作用(函数总是返回 false),这正是 CakePHP 所提示的。

ZendServer 仪表板中的此屏幕显示 APC。

APC Compatibility Layer in Zend Server 7

解决方案是:

  • 通过编辑 app/Config/core.php 完全禁用 APC 缓存注释掉以下几行...
    /*if (extension_loaded('apc') && function_exists('apc_dec') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) {
    $engine = 'Apc';
    }*/
  • 或者,您只能有条件地加载 APC。在我的情况下,我只想在我的本地开发服务器上禁用它,但在生产中保持事件状态。
    $isLocalDevelopment = strpos($_SERVER['SERVER_NAME'], '.dev');
    if (!$isLocalDevelopment && extension_loaded('apc') && function_exists('apc_dec') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) {
    $engine = 'Apc';
    }
  • 关于cakephp - 在 CakePHP 站点中获取 'unable to write' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12987434/

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