Alternative PHP Cache - APC

So., 04/11/2012 - 16:38
Body
http://php.net/manual/de/apc.configuration.php

Web

http://www.23systems.net/2009/07/installing-alterative-php-cache-apc-with-plesk-on-ubuntu/ http://www.howtoforge.com/apc-php5-apache2-debian-etch http://alphanodes.de/apc-richtig-konfigurieren http://xerosphere.net/optimizing-apc-for-drupal | debain wo ist dieapc.php http://kristiansoehl.de/webserver-extrem-tuning-teil-2-php-apc-einrichten/ http://chrisgilligan.com/wordpress/how-to-configure-apc-cache-on-virtual-servers-with-php-running-under-fcgid/

Tuning für Drupal

http://www.valuebound.com/blog/how-improve-drupal-performance-your-localhost

Install APC

APC is a PHP extension that can be installed using PECL. PECL comes with the php-pear package, so we install that now:
  1. apt-get install php-pear
Furthermore we must install some APC dependencies so that PECL can build APC:
  1. apt-get install php5-dev apache2-prefork-dev build-essential
Now that all dependencies are installed, we can install APC as follows:
  1. pecl install apc
dann ENTER
EDIT ASEITZ: Unter Ubuntu 9.04 und 10.04 gibt es wohl noch ein problem beim ausführen von pecl install apc
Dieses bricht mit folgender Fehlermeldung ab
  1. running make
  2. ...
  3. /tmp/pear/temp/APC/php_apc.c:959: error: duplicate ‘static’
  4. make: *** [php_apc.lo] Fehler 1
  5. ERROR: `make' failed
Lösung: APC Beta benutzen
  1. sudo pecl install apc-beta
Quellen: http://pecl.php.net/bugs/bug.php?id=16078
http://constantshift.com/installing-apc-for-php-5-3/


Now that APC is installed, we create the configuration file /etc/php5/conf.d/apc.ini. We must at least add the line extension=apc.so in there; all other configuration options are optional. You can find a list of all available configuration options on http://de2.php.net/manual/en/ref.apc.php.
  1. vi /etc/php5/conf.d/apc.ini
Inhalt:
  1. extension=apc.so
  2. apc.enabled=1
  3. ; The size of each shared memory segment in MB.
  4. apc.shm_size=32M
Hier ist wichtig das für die apc.shm_size auch die Einheit z.b. M = Mega, G = Giga mit für die shared memory segmentegröße angegeben wird. Lässt man diese weg, so spuckt PHP5.3 folgndes Warning aus
  1. PHP Warning:  PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files
Quelle: http://blog.tschagrass.de/category/apc/ FINSIHED

Für Drupal

http://drupal.org/node/1777090 http://xerosphere.net/optimizing-apc-for-drupal http://andrewdunkle.com/how-install-apc-alternative-php-cache-drupal-7#

Beispiel Config meines Debians in meiner lokalen VM

extension=apc.so apc.enabled=1 apc.stat=1 apc.cache_by_default = 1 apc.shm_segments=1 ; DO NOT USE M apc.shm_size=256M apc.ttl=0 apc.user_ttl=600 apc.gc_ttl=600 apc.num_files_hint=2048 apc.max_file_size=2M apc.mmap_file_mask=/dev/zero apc.enable_cli=0 #for drupal, if one drupal will throw errors apc.include_once_override=0
Add new comment
The content of this field is kept private and will not be shown publicly.

Plain text

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.