FastCGI mode is known to be a fast and secure way to run PHP on your server... FastCGI is also preferred compared to mod_php as it allows websites to execute with the user's permissions (like with suPHP) and as some claim, it's also faster than mod_php.
Assuming you have PHP in FastCGI mode running on your WHM/cPanel (version 11.28+) based server, there are 3 simple steps to install APC on your server:
1. Login as "root" user via SSH and run this command:
yum install pcre-devel
This will install some required dependencies for the next steps...
2. Login to WHM and navigate to "Service Configuration" >> "PHP Configuration Editor", then "Switch to Advanced Mode" and change under section "Core" and command "extension_dir" the PHP extensions path from "/usr/local/lib/php/extensions/no-debug-non-zts-200XXXXX" to "/usr/lib/php/extensions/no-debug-non-zts-200XXXXX". 200XXXXX depends on the PHP version installed on your server. If it's PHP 5.2 you'll see 2006XXXX, if it's PHP 5.3 you'll see 2009XXXX. Save and restart Apache.
ln -s /usr/local/lib/php/extensions/no-debug-non-zts-200XXXXX /usr/lib/php/extensions/no-debug-non-zts-200XXXXX
Don't forget to change 200XXXXX to your actual system folder.
The above shortcut will just copy any future PHP extensions to the cPanel default directory for installed PHP extensions.
3. 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.
That's it!
Now, if you wanna make use of APC on your Joomla! 1.5/1.7 site, go to "Global Configuration" and choose to use "Apc" instead of "File" for the cache setting. Using "Apc" instead of "Database" for the sessions didn't work for me in Joomla! 1.5 last time I checked. Perhaps it now works with 1.7+.
You may also wish to tweak "apc.shm_size" in PHP's configuration and raise this limit from 32 (MBs) to 64 or 128 depending on your server's capabilities. For very busy sites, you may want to consider switching off "apc.slam_defense" and "apc.stat". For more on APC's configuration options, visit: http://php.net/manual/en/apc.configuration.php
UPDATE: APC provides a detailed look at what is happening with your cache and, with GD enabled in PHP, also shows you graphs of the situation of your cache. And all this via your browser! After you follow the steps above and install APC successfully, copy the file /usr/lib/php/apc.php into your website's "live" path and access it via the browser. Just remember to change permissions of apc.php to the user whose website you're moving the script in.
