Installing APC for PHP-FPM on Ubuntu 11.04 (Natty Narwhal)

My new development environment, Ubuntu 11.04, contains the php5-fpm package that hasn’t been available on 10.04. PHP-FPM is especially important when developing on the LEMP stack which uses Nginx instead of Apache. In this tutorial, you will not build anything from source.

Quick Installation

This is the fastest installation possible using Ubuntu’s packages. Everything is automatically configured so that you can skip to Post Installation.

$ sudo apt-get install php5-fpm php-apc

PECL Installation

If you prefer using the PECL package manager for PHP instead, then there’s extra configuration required. The PECL installation is preferred for most Linux distributions without the php-apc package shown above.

$ sudo apt-get install php5-fpm php-pear php5-dev

First, we need the additional php-pear and php5-dev are required for PECL.

$ pecl install apc

PECL will handle the installation APC but at the end, you’re required to configure php.ini.

$ sudo echo "extension=apc.so" >> /etc/php5/fpm/php.ini

In this case, we’re using PHP-FPM, so we’re appending the configuration to the PHP-FPM php.ini located at /etc/init.d/php.ini.

Post Installation

Finally, restart PHP-FPM to see changes.

$ sudo /etc/init.d/php5-fpm restart

If you’re unsure whether APC is enabled, you can check phpinfo().

Have fun with web development.

This entry was posted in Ingenuity and tagged , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • About Gio

    I am a torrent of ingenuity (or insanity) with a myriad of innovations (sometimes fallacies) and a wealth of inspiration (possibly naiveté). My name is Gio Carlo Cielo Borje and I like puffer fish because they're just cooltalkin', highwalkin' and fastlivin'.

    I'm also nineteen and a current student at UC Irvine for Computer Science.