moving home part 2 - installing apc

Posted by myles Mon, 13 Nov 2006 01:54:00 GMT

As part of the processing of migrating our moodle sites to their new home, I investigated setting up apc - the "alternative php cache" managed as a pecl project.

Installing apc on Ubuntu couldn’t be easier… this is basically a post I contributed to Moodle.org … thought it’d be useful here too.

 

Assuming you have php5 and apache2 all up and happy on your Ubuntu server ;)… this should get you over the line with apc:

1. Install pear (and the various libraries for pecl to install)

apt-get install php-pear php5-dev apache2-threaded-dev

2. Fix a silly name/version change problem with apxs by adding a symbolic link to the right file

ln -s /usr/bin/apxs2 /usr/bin/apxs

3. Install apc

pecl install apc

4. Make sure that php knows to use it… edit /etc/php/apache2/php.ini and add

extension=apc.so

5. Restart Apache and you’re away!

/etc/init.d/apache2 restart

Of course, try it out in your dev environment first… but it should yield significant benefits.

NB. In my dev environment this worked perfectly… but a pecl setting shut me down on 64 bit Ubuntu… complained during the installation at step 3… something like "Fatal error: Allowed memory size of 8388608 bytes exhausted…" for some reason it’s using its own ini values… (not either the php.ini values for cli or apache).

If so… edit /usr/share/php/pearcmd.php and add:

@ini_set('memory_limit', '16M');
Comments

Leave a comment

Comments