domingo, 29 de março de 2015

INSTALAÇÃO DO ALTERNATIVE PHP CACHE (APC) NA DREAMHOST UBUNTU 12.04LTS PARA DRUPAL

VAMOS INSTALAR O APC PARA RODAR COM O DRUPAL

Você tem que ter um servidor VPS, servidor com acesso de superusuário para instalar estas coisas.

  1. Faça download do APC: wget http://pecl.php.net/get/APC-3.1.13.tgz  
  2. Descompacte-o: tar xvf APC-3.1.13.tgz
  3. Entre na pasta descompactada: cd APC-3.1.13
  4. Execute o comando: phpize (Com PHP 5.3: /usr/local/php53/bin/phpize, Com PHP 5.4: /usr/local/php54/bin/phpize)
  5. ./configure; make (for PHP 5.3 domains: ./configure --with-php-config=/usr/local/php53/bin/php-config; make or for PHP 5.4 domains: ./configure --with-php-config=/usr/local/php54/bin/php-config; make)
  6. Copie o arquivo apc.so que está na pasta modules para a pasta /usr/local/php54/lib/php/extensions/no-debug-non-zts-20100525

CONFIGURE O APC
Crie a pasta ".php/5.4" no raíz do seu site. "5.4" é a versão do PHP que você tem.
Crie um arquivo chamado "phprc" contendo:

memory_limit = 128M
 realpath_cache_ttl = 300
 realpath_cache_size = 1M
 output_buffering = 1

 [APC]
 extension=apc.so
 apc.enabled=1
 apc.shm_segments=1

 ;32M per WordPress install
 apc.shm_size=64M

 ;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

 apc.cache_by_default=1
 apc.use_request_time=1
 apc.slam_defense=0
 apc.stat_ctime=0
 apc.canonicalize=1
 apc.write_lock=1
 apc.report_autofilter=0
 apc.rfc1867=1
 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


Você tem que criar esse phprc em cada domínio que você tiver.
Copie o arquivo "apc.php" que está na pasta do APC-3.1.13 para a pasta /sites/all/apc.php do seu drupal. Entre nele para ver se está tudo rodando direitinho.

INSTALANDO O APC NO DRUPAL 6

Instale o módulo "cacherouter".
Não esqueça de configurar o sites/default/settings.php:

#  ------------
#  CACHE ROUTER
#  ------------
  $conf['cacherouter'] = array(
    'default' => array(
      'engine' => 'apc',               // apc, memcache, db, file, eacc or xcache
      'server' => array(),             // memcached (host:port, e..g, 'localhost:11211')
      'shared' => TRUE,                // memcached shared single process
      'prefix' => '',                  // cache key prefix (for multiple sites)
      'path' => 'files/filecache',     // file engine cache location
      'static' => FALSE,               // static array cache (advanced)
    ),

  );

Não esqueça de reiniciar o servidor VPS. Faça login na Dreamhost, vá em VPS > DASHBOARD e clique em RESTART.

Fonte: http://wiki.dreamhost.com/APC

Nenhum comentário:

Postar um comentário