问题
I am trying to use xcache with zend framework to cache the metadata from Zend_Db_Table_Abstract so that describe queries are only called once per table. When implementing xcache into my bootstrap and running the application, I am being presented with the following error:
Warning: xcache_get() [function.xcache-get]: xcache.var_size is either 0 or too small to enable var data caching in /home/randall/htdocs/lib/Zend/Cache/Backend/Xcache.php on line 95.
I have adjusted the settings in my php.ini:
; XCACHE
626 [xcache-common]
627 zend_extension=/usr/lib/php5/20060613/xcache.so
628
629 [xcache-admin]
630 xcache.admin.enable_auth = On
631 xcache.admin.user = "user"
632 xcache.admin.password = "********"
633
634 [xcache]
635 xcache.shm.scheme = "mmap"
636 xcache.size = 128M
637 xcache.count = 4
638 xcache.slots = 8K
639 xcache.ttl = 0
640 xcache.gc_interval = 0
641
642 xcache.var_size = 64M
643 xcache.var_count = 1
644 xcache.var_slots = 8K
645 xcache.var_ttl = 0
646 xcache.var_maxttl = 0
647 xcache.var_gc_interval = 300
648 xcache.test = Off
649
650 xcache.readonly_protection = Off
651 xcache.mmap_path = "/tmp/xcache"
652 xcache.coredump_directory = ""
653
654 xcache.cacher = On
655 xcache.stat = On
656 xcache.optimizer = Off
657
658 [xcache-coverager]
659 xcache.coverager = On
660 xcache.coveragedump_directory = ""
but i still continue to get the error no matter what I set the xcache.var_size parameter to. This occurs on xcache 1.2.2 and 1.3.0. Any help would be appreciated.
回答1:
Run a phpinfo()
, and see if those settings are accurate/to make sure the correct php.ini is loaded. Also, try setting the mmap_path to "/dev/zero" (All it does is disable readonly_protection, which you don't have enabled anyway)...
回答2:
I had this problem with Doctrine CLI commands. Changing the var_size or the mmap_path had no effect. To get the errors to go away, I removed/commented out all references to Xcache from php.ini. The commands and my web application still worked afterwards but the errors were gone.
来源:https://stackoverflow.com/questions/2976829/xcache-var-size-error