Installing APC on CentOS 5 Server
113 Views Published 3 months, 2 weeks ago in Announcements, vBulletin FansvBulletin.com Blog Entry: Installing APC on CentOS 5 Server
Author: Floris
Published: 24th April 2008 06:43 PM
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 and how to let vBulletin take use of it. 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.
Code:
yum install php-pear
and we will need the following package
Code:
yum install php-devel
and we probably need the apxs command
Code:
yum install httpd-devel
Now we have all the software we need, so we install apc via the pecl command:
Code:
pecl install apc
To enable apc in Apache's configuration. The following command should do this for us.
Code:
echo "extension=apc.so" > /etc/php.d/apc.ini
Then we restart Apache:
Code:
/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:
Find: Code:
// $config['Datastore']['class'] = 'vB_Datastore_Filecache';
and replace it with Code:
$config['Datastore']['class'] = 'vB_Datastore_APC';
Still in the config.php file you will now find (from 3.7.1 and up) the following option: Code:
// $config['Datastore']['prefix'] = '';
I recommend to change this if you have multiple forums running on the same box. Since each of my forums uses a unique table prefix based on the domain name, I am using this table prefix for the datastore APC prefix too. Example; my web site vbulletin-fans.com is vbfans_ as table prefix. So I will use this for this instance: Code:
$config['Datastore']['prefix'] = 'vbfans_';
Keep this as simple and short as possible, but unique.
To test if it works your PEAR/APC should have come with a file called apc.php. You can now copy this to your vBulletin's directory and edit the file. Set a new user/pass for authentication and load the file in your browser. When you're done you can remove the apc.php file from this public dir.
And you're done.
I hope this helps some site owners to get a bit more performance out of their vBulletin powered community and give their visitors a more snappy experience. Note that 3.7 support APC but it works just as well without it. Hopefully in the future (say version 4 and up) vBulletin will make more and better use of op-cache like APC.
Read More... :)
Tags: installation, server, test, vb, vbulletin
Author: Floris
Published: 24th April 2008 06:43 PM
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 and how to let vBulletin take use of it. 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.
Code:
yum install php-pear
and we will need the following package
Code:
yum install php-devel
and we probably need the apxs command
Code:
yum install httpd-devel
Now we have all the software we need, so we install apc via the pecl command:
Code:
pecl install apc
To enable apc in Apache's configuration. The following command should do this for us.
Code:
echo "extension=apc.so" > /etc/php.d/apc.ini
Then we restart Apache:
Code:
/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:
Find: Code:
// $config['Datastore']['class'] = 'vB_Datastore_Filecache';
and replace it with Code:
$config['Datastore']['class'] = 'vB_Datastore_APC';
Still in the config.php file you will now find (from 3.7.1 and up) the following option: Code:
// $config['Datastore']['prefix'] = '';
I recommend to change this if you have multiple forums running on the same box. Since each of my forums uses a unique table prefix based on the domain name, I am using this table prefix for the datastore APC prefix too. Example; my web site vbulletin-fans.com is vbfans_ as table prefix. So I will use this for this instance: Code:
$config['Datastore']['prefix'] = 'vbfans_';
Keep this as simple and short as possible, but unique.
To test if it works your PEAR/APC should have come with a file called apc.php. You can now copy this to your vBulletin's directory and edit the file. Set a new user/pass for authentication and load the file in your browser. When you're done you can remove the apc.php file from this public dir.
And you're done.
I hope this helps some site owners to get a bit more performance out of their vBulletin powered community and give their visitors a more snappy experience. Note that 3.7 support APC but it works just as well without it. Hopefully in the future (say version 4 and up) vBulletin will make more and better use of op-cache like APC.
Read More... :)
Search
About This Entry
- You’re currently reading “Installing APC on CentOS 5 Server,” an entry on The Staff Lounge
- Published at 8.17.08 / 12pm
Related Entries
- [Any Version] Database Configuration for GoDaddy - vBulletin Tips
- Dougal Campbell: XCache Object Cache Plugin for WordPress 2.5+ - Wordpress
- Andy Skelton: Upgrade Memcached Before WordPress - Wordpress
Recent Entries
- Weblog Tools Collection: WordPress Plugin Releases for 12/04 - Wordpress
- Lorelle on WP: Countdown to WordPress 2.7 - Wordpress
- Weblog Tools Collection: WordCamp Chicago - Wordpress
Popular Resources
- Phorum-5.2.9a released (6 replies) - 5074 Views
- Phorum-5.2.8 final released (13 replies) - 3768 Views
- 3.8 on vbulletin.com - 2059 Views







No Responses to “Installing APC on CentOS 5 Server”
Please Wait
Leave a Reply