How to install APC in Ubuntu 12.04

This installation is through PEAR. You can install it in other methods too. This has installed APC 3.1.9 for me over Ubuntu 12.04 LTS.

[code lang=”bash”]sudo apt-get install build-essential libpcre3-dev php5-dev
sudo pear update-channels
sudo pecl install apc[/code]

And it’s done:

[code lang=”bash”]Build process completed successfully
Installing ‘/usr/lib/php5/20090626/apc.so’
Installing ‘/usr/include/php5/ext/apc/apc_serializer.h’
install ok: channel://pecl.php.net/APC-3.1.9
configuration option “php_ini” is not set to php.ini location
You should add “extension=apc.so” to php.ini[/code]

This is tested against Ubuntu 10.04 as well as Ubuntu 10.10 environments.

You can add it to /etc/php5/conf.d/apc.ini by:

[code lang=”bash”]nano /etc/php5/conf.d/apc.ini[/code]

Add in the following codes:

[code lang=”php”]
extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=32M
apc.cache_by_default=1
apc.stat=1
apc.rfc1867=1 //For Drupal upload progress.
apc.stat=7200 //2 hours
[/code]

1 thought on “How to install APC in Ubuntu 12.04”

  1. Hi Tony, there isn’t a sure fire way to optimize your website. If you are using tools like Drupal or Joomla, you might want to look into optimizations for that in addition to turning on APC. I hope this helps.

Comments are closed.