Site Daemon
If you run a popular SocialEngine website on a powerful VPS or even dedicated server running WHM/cPanel, chance is you may have stumbled upon performance issues at some point...
There are many tutorials out there covering how to install APC from command line (as root user), but none on how to install APC on a WHM/cPanel server "the easy way". And it's actually pretty easy...
Assuming you have a running WHM/cPanel based server updated to version 11.28+, there are 6 simple steps to install APC on your server:
1. Login as "root" user via SSH and simply run the command:
# yum install pcre-devel
This will install some required dependencies for the next steps...
2. Still logged in on WHM, navigate to "Software" >> "Module Installers" then click on "manage" next to "PHP Pecl", search for "APC" in "Find a PHP Pecl" and then choose to "Install" in the APC result that will come up.
3. in SSH copy apc.so to php extension folder :
# cp /usr/lib/php/extensions/no-debug-non-zts-20060613/apc.so /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
4. Check your /usr/local/lib/php.ini and commentout the line with zendoptimizer.so, APC won't load if zend optimizer is loaded.
5. Increase kernel.shmmax normally if you have 1GB or more RAM, in SSH do this :
# nano /etc/sysctl.conf
add this line, means 128MB
kernel.shmmax = 134217728
I'm assuming you know how to used nano editor.
Apply the changes to current running system
# sysctl -w kernel.shmmax=134217728
6. Enable Piped Log Configuration, this will avoid APC restarted often.
in WHM/Cpanel go to Apache Configuration->Enable Piped Log Configuration
7. Edit your php.ini
# nano /usr/local/lib/php.ini
Add this lines
; APC Configuration
extension="apc.so"
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128M
apc.max_file_size = 2M
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1024
apc.enable_cli = 1
8. Restarted your webserver in WHM/Cpanel goto HTTP Server (Apache)