APC 는 업데이트된지 오래 되었고 PHP 5.5 에서는 지원하지 않으므로 PHP 5.5 부터 내장된  Zend OPcache 를 사용하는 걸 권장한다.

 

Windows

  1. http://dev.freshsite.pl/php-accelerators/apc.html 에서 다운로드 및 압축 해제
    1. Win7/2008 용 다운로드 - php_apc_3114_beta_php54_win7-2008.zip
  2. 파일중에 php_apc.dll를 PHP 설치 폴더내 ext 에 복사
  3. c:\windows\php.ini 에 다음 내용 추가

    extension=php_apc_3114_beta_php54_win7-2008.dll
    CODE

 

http://windows.php.net/downloads/pecl/releases/apc/에서 배포하는 apc 는 디버그 로그를 출력하는 치명적인 문제가 있어서 사용 불가

Notice: Unknown: 1. h->opened_path=[null] h->filename=[xxxx] in Unknown on line 0 

Notice: Unknown: apc_cache_find [-1302308902] in Unknown on line 0 

 

 

RHEL /CentOS

  1. WebTatic 이나 Remi 저장소 를 설치한다. (RHEL/CentOS php 5.4 설치 참고)
  2. yum 으로 설치

    yum install php54w-pecl-apc
    CODE

 

 

공통 설정

  1. php.ini 에 다음 내용 추가

    [apc]
    apc.enabled=1
    apc.shm_segments=1
    apc.shm_size=256M
    ;Relative to the number of cached files (you may need to watch your stats for a day or two to find out a good number)
    apc.num_files_hint=7000
    ;Relative to the size of WordPress
    apc.user_entries_hint=4096
    ;The number of seconds a cache entry is allowed to idle in a slot before APC dumps the cache
    apc.ttl=7200
    apc.user_ttl=7200
    apc.gc_ttl=3600
    ;Setting this to 0 will give you the best performance, as APC will not have to check the IO for changes. However, you must clear the APC cache to recompile already cached files. If you are still developing, updating your site daily in WP-ADMIN, and running W3TC set this to 1
    apc.stat=1
    ;This MUST be 0, WP can have errors otherwise!
    apc.include_once_override=0
    ;Only set to 1 while debugging
    apc.enable_cli=0
    ;Allow 2 seconds after a file is created before it is cached to prevent users from seeing half-written/weird pages
    apc.file_update_protection=2
    ;Leave at 2M or lower. WordPress does't have any file sizes close to 2M
    apc.max_file_size=2M
    ;Ignore files
    ;apc.filters = "/var/www/apc.php"
    apc.cache_by_default=1
    apc.use_request_time=1
    apc.slam_defense=0
    ;;apc.mmap_file_mask=/var/www/temp/apc.XXXXXX
    apc.stat_ctime=0
    apc.canonicalize=1
    apc.write_lock=1
    apc.report_autofilter=0
    apc.rfc1867=0
    apc.rfc1867_prefix =upload_
    apc.rfc1867_name=APC_UPLOAD_PROGRESS
    apc.rfc1867_freq=0
    apc.rfc1867_ttl=3600
    apc.lazy_classes=0
    apc.lazy_functions=0
    CODE
  2. apache httpd 재구동

 

Ref