PHP + APC + Drupal

1. 安裝APC,下載APC源代碼

     phpize - 生成configure文件

    ./configure --with-php-config=/root/to/php/bin/php-config

    make; make install

2. 編輯php.ini,例如

    extension=apc.so
    apc.enabled=1
    apc.shm_size=128M
    apc.ttl=7200
    apc.user_ttl=7200
    apc.enable_cli=1 

    這裏需要注意一下,APC和ZO不能共存,需要把ZO註釋掉

    通過apc.php可以查看運行狀態

3. 下載並安裝drupal的APC模塊

    引用README中

    APC normally has a limited memory allocation (32M) and should be used to cache the entries which are used most since it's the cache closest (and maybe fastest) 

    toPHP. When the memory allocated by APC is big enough to cache the entire drupal cache (to do so check the size of the cache_% tables in the database when the  

    cache is hot) you can use Step2b, if not use step 2a.

    - Step 2a
    Add the following code to your settings.php file:


    /**
     * Add APC Caching.
     */
    $conf['cache_backends'] = array('sites/all/modules/apc/drupal_apc_cache.inc');
    $conf['cache_class_cache'] = 'DrupalAPCCache';
    $conf['cache_class_cache_bootstrap'] = 'DrupalAPCCache';
    //$conf['apc_show_debug'] = TRUE;  // Remove the slashes to use debug mode.

    - Step 2b
    Add the following code to your settings.php file:

    /**
     * Add APC Caching.
     */ 
    $conf['cache_backends'] = array('sites/all/modules/apc/drupal_apc_cache.inc');
    $conf['cache_default_class'] = 'DrupalAPCCache';
    //$conf['apc_show_debug'] = TRUE;  // Remove the slashes to use debug mode.

    

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章