config_cache_enabled Errors

怎甘沉沦 提交于 2020-01-13 18:22:48

问题


Using Zend Framework 2.1

When I set 'config_cache_enabled' => true inside of my application.config.php

It's returning the following error:

Warning: var_export does not handle circular references in /usr/local/apache/vhosts/otwebsoft_admin/vendor/Zend/ModuleManager/Listener/AbstractListener.php on line 67

After a few refreshes of the page then I get this:

Fatal error: Call to undefined method Zend\Cache\Storage\Adapter\Apc::__set_state() in /usr/local/apache/vhosts/otwebsoft_admin/data/cache/module-config-cache.otwebsoft.php on line 181

I can see now that file is created on the server. Of course setting the value back to false in the config removes all the errors. But now we have loss of cacheing functionality.

Yes, I am using the APC Adapter for my cache.

Reading the PHP documentation it recommends to use serialize. So I looked at the source code and changed the var_export to serialize and that removes that error, but it brings back the 2nd error listed here.

Any ideas?


回答1:


I've finally figured this out. I don't know why it took me so long but everything makes sense now.

So a closure would be something like:

'example' => factory()
{
    return new Example();
}

Where-as I should be using (for example):

'example' => 'Module/Service/Example'

After I removed all the closures I'm now able to use

'config_cache_enabled' => true


来源:https://stackoverflow.com/questions/14653485/config-cache-enabled-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!