我有高 TTFB(到第一个字节的时间)的问题。我必须安装 APC 或 xcache,这两者都没有在我的 apache 网络服务器上启动。
请告知如何安装 APC 或 xcache。opcache 已经安装了,但是我不知道在 Symfony2 中如何使用。
rpandey@FIRST-PC /c/xampp/htdocs/ims
$ php -v
C:\xampp\php\ext\php_apc.dll doesn't appear to be a valid Zend extension
PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
In the php.ini I have,
[APC]
zend_extension = "C:\xampp\php\ext\php_apc.dll"
;specifies the size for each shared memory segment 8MB to start
apc.shm_size=8M
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=1
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
apc.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1
在我的 app/config/config_prod.yml
我想做这两个框架:
framework:
validation:
cache: validator.mapping.cache.apc
serializer:
cache: serializer.mapping.cache.apc
#doctrine:
# orm:
# metadata_cache_driver: apc
# result_cache_driver: apc
# query_cache_driver: apc
我现在已经评论了教义。以后会处理的。
在,app.php:我想做以下
$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);