Installing APC on CentOS 5 Server

Bigger PHP applications, such as vBulletin can gain a lot of increased performance from running a PHP op-code cache/accelerator such as APC.

Here are some instructions on how install APC on various systems, my personal experience is with what appears the most common: 32bit CentOS 5 Server.

APC is maintained by core PHP developers, APC does not utilze a disk cache, unlike both eAccelerator and Xcache (although it is probably configurable). URL: http://pecl.php.net/package/APC

A drawback to consider is that due to known segfaults you could get an increase in error 500 or blank pages.

vBulletin 3.7 RC4 came with this in the announcement: “We recommend that vBulletin 3.7 is run on PHP 5.2.5 with APC (or a similar opcode cache) and MySQL 5.0.51 for best performance and stability.

Here are some instructions on how install APC on various systems, my personal experience is with what appears the most common: 32bit CentOS 5 Server

Please note, due to installed control panels installation instructions might differ, this is for a dedicated box with no control panel.

Lets first install the pecl command so we can later download and install APC from the repositories.

yum install php-pear

and we will need the following package

yum install php-devel

and we probably need the apxs command

yum install httpd-devel

Now we have all the software we need, so we install apc via the pecl command:

pecl install apc

To enable apc in Apache’s configuration. The following command should do this for us.

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

Then we restart Apache:

/etc/init.d/httpd start

(though: service httpd restart should work too)

You can find out if APC is now running by loading a phpinfo() page (vBulletin AdminCP > Maintenance > phpinfo) and search for APC block.

Now that it works, go into the includes/config.php file and enable the datastore class to use APC:

$config['Datastore']['class'] = 'vB_Datastore_APC';

And you’re done.


Posted

in

by