cPanel Config

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

How to install APC (PHP Cache)

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4 out of 5)
Loading ... Loading ...

Posted by admin


What is APC?
APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.
Install instructions

  1. Login to the server as root
  2. Download APC
  3. wget http://pecl.php.net/get/APC-3.0.14.tgz

  4. Extract and move into the directory
  5. gzip -d APC-3.0.14.tgz
    tar -xf APC-3.0.14.tar
    cd APC-3.0.14

  6. Locate where php is
  7. which php

    This should return something like: /usr/local/bin/php
    We have to remember the location of php

  8. Create configuration files
  9. phpize

  10. Compile APC
  11. ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
    make
    make install

    The “make install” commnand will return the location of the apc.so extention please note the location. You will need this later.

  12. Install APC into php.ini
  13. You will have to first locate php using the locate command

    locate php

    This will usualy return /usr/local/Zend/etc/php.ini on a server that has Zend optimizer installed.
    Now we will edit php.ini and add the APC extension.

    pico /usr/local/Zend/etc/php.ini

    Scroll down to the buttom and add the fallowing before the lines about the zend optimizer (They start with [Zend])

    extension=”/apc_location/apc.so”

  14. Restart Apache
  15. If you done everything it’s time to restart Apache

    service httpd restart

Hope this helps !

Share this: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • De.lirio.us
  • Furl
  • MyShare
  • Smarking
  • Technorati
  • YahooMyWeb

If you enjoyed this post, make sure you subscribe to my RSS feed!

2 Responses to “How to install APC (PHP Cache)”

  1. For others who found this as easy to use as I did, a couple of notes.

    If your running suPHP like I am, then leave out –with-apxs.

    Also, don’t try to copy and paste this on the terminal line. Each one of the above dashes is actually two dashes - - together. It just doesn’t copy/paste well :-)

    Thanks for the informative article!

  2. Hi Eric

    You say to leave out -with-apxs when running suphp
    I did that, but found that APC isn’t caching very many files, infact, only 16 on my entire web server
    If I switch the php handler to DSO, or FCGI however, that figure rises quite dramatically
    Have you managed to get apc working properly with suphp? If so, could you post how you did it?

Leave a Reply