Speed up Magento


During the last few years, Magento has quickly established itself as one of the leading ecommerce platforms on the Web. It’s open source architecture and adaptability have made it  an excellent choice for full range of users,  starting from small shops to large enterprise clients.  There is a huge community of programmers behind it, and number of extensions and plugins for it is  growing constantly.  Although Magento  is very powerful it is not without it’s drawbacks. One of main issues people have regarding Magento is it’s speed, as it tends to be pretty slow if no optimizations are made.

One of the ways to give your Magento installation a speed boost is installing The Alternative PHP Cache (APC), a free and open opcode cache for PHP on your server.  Although the actual speed gain may vary, in most of the cases it provides instant speed up for both back end and front end. Let us delve into the installation process itself.

First, you need to install pcre package, as it is required for APC installation. Execute these commands from SSH shell:

cd ~
yum install pcre-devel

Next, we get the needed files from pecl.php.net server, and prepare them for installation:

cd ~
mkdir setups
cd setups
wget http://pecl.php.net/get/APC-3.1.5.tgz
tar -xvf APC-3.1.5.tgz
cd APC-3.1.5
./configure –enable-apc –enable-apc-mmap –with-apxs –with-php config=/usr/local/bin/php-config

Files are now ready for install, and we do it by executing a simple command:

make install

Now we need to enable APC in php.ini. Open your php.ini file and add these lines:

apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 64
apc.max_file_size = 10M

Now you should restart your Apache server, and then enable APC caching in Magento. You do this by adding this piece of code under <global> tag in app/etc/local.xml file of your Magento installation:


Congratulations, you have successfully installed and configured APC on your Magento store! You should see almost immediate boost in speed and responsiveness of the site. One thing that you should note is that APC and Zend Optimizer don’t work well together, so if you have Zend Optimizer installed, turn it off by commenting out it’s configuration lines in php.ini.

Bear in mind that this is only the tip of the iceberg when it comes to the Magento speed optimization. There are many more methods and tweaks that can be implemented, and I hope I will be writing about them soon.