I have had this problem before on WAMP Server and PHP 5.3,現在在Linux上面向PHP 5.4。APC沒有加速PHP 5.4
基本上,APC啓用或禁用在性能上沒有任何區別,儘管apc.php中的統計數據表示。
下面是一個簡單的測試腳本,其中包括30個多名主義PHP文件,有時它:
$t = microtime(true);
include 'Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php';
printf('%.3f s', microtime(true)-$t);
- 在Windows(Zend Server CE中,PHP 5.4)結果:
0.001 s
- 結果在Linux(PHP 5.4 & APC 3.1.11):
0.106 s
注意:即使沒有顯示在上面的腳本中,我實際上使用了文件的完整路徑,而不依賴於include_path。
結果我得到的Linux是一樣的apc.enabled
是0
或1
,所以它看起來像指令緩存只是不工作。
然而,apc.php
說:
套餐(從remi repository,CentOS的6.3):
php-5.4.5-1.el6.remi.x86_64
php-pecl-apc-3.1.11-1.el6.remi.1.x86_64
APC配置:
apc.enabled=1
apc.shm_segments=1
apc.shm_size=64M
apc.num_files_hint=1024
apc.user_entries_hint=4096
apc.ttl=7200
apc.use_request_time=1
apc.user_ttl=7200
apc.gc_ttl=3600
apc.cache_by_default=1
apc.file_update_protection=2
apc.enable_cli=1
apc.max_file_size=1M
apc.stat=1
apc.stat_ctime=0
apc.canonicalize=0
apc.write_lock=1
最後一件事,是,PHP做報告APC爲啓用:
var_dump(extension_loaded('apc')); // (bool) true
我有同樣的麻煩!如果有人能幫忙,我很樂意。 – 2012-08-07 07:07:35
堆棧溢出一個很好的PHP問題?所有的UPVOTES! – cmbuckley 2013-05-11 12:17:15