Using PECL-APC with Gallery
I recently decided to use a php cache to speed up the response of my websites. I decided to use PECL-APC (Alternative PHP Cache) and I did the following
1. Installing PECL-APC
I’m using PHP5 and Gentoo. The dev-php5/pecl-apc package is masked by the ~x86 keyword and so I have added this line to /etc/portage/package.keywords
dev-php5/pecl-apc ~x86
I then emerged this package using the following command
emerge dev-php5/pecl-apc
2 . Check installation
You can then check this is working by creating a file on your webserver with this line in it
<?php phpinfo(); ?>
and navigating to the page. Do a search on this page for apc. If it’s there then it should be working.
3. Fix Problems with PECL-APC and Gallery
Unfortunately after installing pecl-apc my Gallery installation began to give me the following error.
Fatal error: Call to undefined method GalleryAlbumItem::onLoad() in modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 102
The solution to this problem was to make sure pecl-apc did not cache certain scripts in the Gallery installation, namely the .class files. I edited the /etc/php/apache2-php5/ext/apc.ini file and made the following change.
apc.filters="-Gallery.*\.class"
I then restarted apache and the problem was gone.
Useful Links
May 31st, 2006 at 4:43 am
One point to check is that you requiere a mpm-prefork apache2 install to put to work APC ….
June 10th, 2008 at 2:20 am
This page was helpful, especially as I also use Gentoo.
However, I think you phpinfo command has a space in the wrong place. I believe it should be:
best regards,
-Graham
August 5th, 2008 at 9:17 am
Thanks gstead, fixed now!
June 4th, 2009 at 9:11 pm
Just an update to akin0’s comment: This is no longer a use variable, but instead can by configured by putting ‘APACHE2_MPMS=”prefork”‘ in your /etc/make.conf file. When you do this, you’ll need to have ‘CONFIG_SYSVIPC=y’ in your kernel config (check with ‘zgrep CONFIG_SYSVIPC /proc/config.gz’), and you can not have the threads variable enabled for apache ( add the following to your /etc/portage/package.use : ‘www-servers/apache -threads’ ).