How to Install APC PHP Cache on Plesk / Centos server

What is PHP APC Cache?

If you’ve been around PHP for a while, you’ve probably heard about APC, the Alternative PHP Cache. APC is an opcode cache that can significantly speed up your PHP applications, by caching both PHP code and user variables. Adding APC to an application usually results in improved application response times, reduced server load and happier users. Thanks to 2bits blog for this guide.

APC is an opcode cache that can significantly speed up your PHP applications. When dealing with Plesk web servers with multiple users and websites, APC PHP cache might be required in order to achieve reliable server performance.


Step 1: Getting Started

The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code. It’s an PECL extension which shares the packaging and distribution system with its sister, PEAR. In case you don’t have php-pear installed, run this command:

yum install php-pear

Step 2: APC PHP Dependencies

Next, let’s install any remaining dependencies which are required by PHP APC

yum install php-devel httpd-devel

Step 3: Installing APC using the PECL command

pecl install apc

Step 3: Enable Alternative PHP Cache

Enable APC PHP cache in Apache’s configuration. By using command:

echo "extension=apc.so" > /etc/php.d/apc.ini


Step 4: Restart Apache

Lastly, restart Apache:

/etc/init.d/httpd start

That’s it. Enjoy!



Share this post


Comments