Feb 11, 2012

Improving website load time - part 1

This was quite a shock. Enabling APC extension made a remarkable difference to my site load time.

Here's how to do it in MAMP, Mac (my local environment) -

Go to MAMP->Preferences->Php tab->php Extensions.
Select APC from the dropdown.

How to do it in a linux environment -
Ubuntu -

Install apc -
pecl install apc

If you get any permission errors like "pecl.php.net" is not writeable by the current user", then do this -

sudo pecl install apc

I still got the following error -
pcre.h: No such file or directory

Did a -
sudo apt-get install libpcre3-dev

and then
sudo pecl install apc
worked like a charm.

Next step is to enable the extension in php.ini file. You can do that either in /etc/php5/apache2/php.ini by adding the following line -

extension=apc.so

Important: you will need to restart your apache server to load the apc module.
For Ubuntu -

sudo service apache2 restart



No comments: