Ubuntu 9.10: Setup APC for PHP5 and Apache2

Update 2010-09-25: There is a new blog post (“Ubuntu 10.04: Setup APC for PHP 5.3 and Apache2”) for Ubuntu 10.04.

To set up the Alternative PHP Cache (APC) just follow the instructions below:

  1. Install the required packages:
    # sudo apt-get install php-pear php5-dev apache2-threaded-dev
  2. Install APC:
    # sudo pecl install apc
  3. Create file /etc/php5/conf.d/apc.ini with the following content:
    extension=apc.so
  4. Restart Apache2:
    # sudo /etc/init.d/apache2 restart

After restarting the Apache2 web server a APC section should be included in the phpinfo() output.

Comments

  1. maca

    thx for the tutorial. it helped me to do the trick 🙂

  2. Ty

    Thanks for the instructions; they worked without any problems.

  3. g

    but, how about if we already have
    php and apache2 installed?

    is it possible we don’t need to recompile the downloaded php source? I’m afraid my current php would be changed.

  4. Jan Jonas

    Hi, you don’t either need to reinstall PHP or Apache2 nor you need the PHP sources. Just install the required Ubuntu packages listed in step 1 (if you have these packages already installed, you are fine for step 2). Installing and configuring APC (step 2-4) does not change your PHP (core) installation, it just installs a new PHP extension.

  5. sedat

Leave a comment

Your email address will not be published. Required fields are marked *

*