Archive for February, 2006

Alternative PHP Cache (APC) on Debian

February 2nd, 2006

[Update, March 9th: Be sure to read the comments!]

The Alternative PHP Cache is a great way to improve the performance of webservers. I just finished installing it on mokey the server that runs this site and a number of others, primarily because of our increased use of a content management system called eZpublish which is very powerful, but also very memory hungry. There is no Debian package at the moment, so here is how I installed APC:

  1. Download APC:

    cd /usr/local/src
    wget http://pecl.php.net/get/APC-3.0.8.tgz

  2. Extract the archive:

    tar -xvvzf APC-3.0.8.tgz

  3. Install php and apache development files:

    sudo apt-get install apache-dev php4-dev

    (if you have apache2 it’s apache2-dev)

  4. Run these commands:

    phpize
    export CPPFLAGS="-I/usr/include/apache-1.3 -DAPC_PHP4_STAT"
    ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/bin/php-config

    For apache2 the last line becomes:

    ./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/bin/apxs2 --with-php-config=/usr/bin/php-config

  5. Build it!

    make
    sudo make install

  6. Finally, add this line to the bottom of your /etc/php4/apache/php.ini (or /etc/php/apache2/php.ini)

    extension=apc.so

Good luck, and leave a comment or contact me if you have any problems. If you don’t feel comforable installing apc yourself contact me and I may be able to help.



  • Search
  • You are currently browsing the matthewcarroll.ca archives for February, 2006.

  • Meta

  • Old Browser

    It seems you are using an old web browser (e.g. Internet Explorer 5 or below). This is a security risk to you, since Microsoft no longer releases updates for old versions of Internet Explorer. Also, note that this site is designed to modern internet standards, and the layout may appear strange or plain in older browsers. All the content is still accessible to you, but I strongly recommend you upgrade to a modern, safe, standards-complient browser, such as Firefox. For more information on getting the best experience surfing the web, see browsehappy.com.