Install PHP-APC on CentOS

  1. Yum up some packages:
    yum install make php-pear php-devel httpd-devel
  2. Install APC using pear (the pear installer is smarter than the pecl installer):
    When the installer asks about APXS, say ‘no’. 
    pear install pecl/apc
  3. Tell PHP to load APC:
    echo extension=apc.so > /etc/php.d/apc.ini
  4. Edit the file /etc/php.d/apc.ini, and add the following lines:
    apc.ttl="7200"
    apc.user_ttl="7200"
    apc.shm_segments="3"
    apc.shm_size="90"
  5. Restart Apache: /sbin/service httpd graceful
  6. Copy apc.php into your doc root and monitor the memory usage. If not enough, adjust the settings in apc.ini. When you are not using apc.php, please remember to move it out of docroot, for security.