问题描述
我有一个CakePHP网站,这是抛出的错误(它是罚款的,并已上线几个月 - 不确定问题开始时)。
我得到:
[CORE / Cake / Cache / Cache.php,line 310]
警告(512):_cake_model_缓存无法写入default_projects到Apc缓存[CORE / Cake / Cache / Cache.php ,line 310]
警告(512):_cake_model_缓存无法将default_clients写入Apc缓存[CORE / Cake / Cache / Cache.php,第310行]
警告(512):_cake_model_缓存无法将'default_clients'写入Apc缓存[CORE / Cake / Cache / Cache.php,第310行]
警告(512):_cake_model_缓存无法将default_projectpages写入Apc缓存[CORE / Cache / Cache.php,line 310]
警告(512):_cake_model_缓存无法写入default_projectpages到Apc缓存[CORE / Cake / Cache / Cache.php,第310行]
警告512):_cake_model_缓存无法写入'default_settings'到Apc缓存[CORE / Cake / Cache / Cache.php,第310行]
警告(512):_cake_model_缓存无法写入default_settings到Apc缓存[CORE / Cake / Cache / Cache.php,line 310]
tmp目录是可写的(已将其和所有包含的文件夹和文件设置为0777;也检查它确实更新正确,它确实);我也通过将调试级别设置为0,关闭了在core.php中的错误报告。
大多数网站是罚款,但这个特定的页面被拉入AJAX,我不知道是否有什么区别。
我已经修补它通过设置显示:无蛋糕错误,但我需要了解为什么会发生这种情况。首先,是什么原因造成的错误?
感谢您的帮助! / div>
在Zend Server 7上运行CakePHP站点时,我收到了这个APC缓存错误。不幸的是,Zend Server似乎附带了伪造/替换 ,并且从我的测试变量数据存储不工作(函数总是返回false),这是CakePHP抱怨。
在ZendServer仪表板显示APC。
解决方案是:
-
完全停用APC通过编辑
app / Config / core.php
缓存,以注释掉以下行.../ * if(extension_loaded('apc')&&&&function_exists('apc_dec')&&&php_sapi_name()!=='cli'|| ini_get('apc.enable_cli') )){
$ engine ='Apc';
} * /
-
或者,您只能有条件地载入APC。在我的case我只是想禁用它在我的本地开发服务器,但使其活动生产。
$ isLocalDevelopment = strpos ($ _SERVER ['SERVER_NAME'],'.dev');
if(!$ isLocalDevelopment&& extension_loaded('apc')&& amp;&&&&&php_sapi_name()!=='cli'|| ini_get enable_cli'))){
$ engine ='Apc';
}
I've a CakePHP site which is throwing errors (it was fine at first, and has been online for several months - not sure when the problem started).
I'm getting:
[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]
I've made sure that the tmp directory is writeable (have set it and all contained folders and files to 0777; also checked that it did update properly, and it did); I've also switched off error reporting in core.php by setting the debug level to 0.
Most of the site is fine, but this particular page is pulled in by AJAX, and I don't know whether that's making any difference.
I've patched it by setting "display: none" on cake-error, but I need to understand why this is happening. Firstly, what's causing the error? And secondly, why is the core setting being ignored?
Thanks for any help!
I was getting this APC caching error when running a CakePHP site on Zend Server 7. Unfortunately Zend Server appears to ship with a fake/substitute APC layer, and from my tests the variable data-store doesn't work (the functions always return false) which is what CakePHP is complaining about.
This screen in the ZendServer dashboard shows APC.
The solution is to either:
Completely disable APC caching by editing
app/Config/core.php
to comment out the following lines.../*if (extension_loaded('apc') && function_exists('apc_dec') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) { $engine = 'Apc'; }*/
OR, you can only load APC conditionally. In my case I just wanted to just disable it on my local development server but leave it active for production.
$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站点上“无法编写”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!