APC Cache Optimization
While we installed PHP with other things, we also installed a
APC is one of the most popular caching mechanism for PHP’s op-code caching. Once activated, it starts caching PHP codes automatically. It also works nicely with W3 Total Cache plugin for storing Object & MySQL caches.
APC – Web-based User Interface
Its always better to check if APC is working correctly. Thankfully, APC comes with file
apc.php, which provides a simple web-based interface. Just copy it to your site’s web-root folder:
cp /usr/share/doc/php-apc/apc.php /var/www/example.com/htdocs
http://example.com/apc.php in browser.
In case you want to use admin-side of
apc.php, you will need to change default password to something else.
Just open apc.php file and edit following line:
defaults('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!!
You can change a few more defaults to customize web-based UI as per your needs.
APC Cache Configuration
You can tweak APC’s parameter by editing
vim /etc/php5/conf.d/20-apc.ini (if you have installed PHP this way). In other cases, you can simply add following values to your
apc.php is showing miss-rate above 10%, the chances are high that you need to change value of some APC configuration option.
There are many APC configuration options, but I recommend making changes to the following:
Total RAM storage allocated for APC (default is 32 MB)
Maximum size of a single file APC can store (default is 1MB)
Number of op-code “files” APC can store (default is 1000)
Number of data entries APC can store (default is 4096)
Once you are done with tweaking, you need to restart PHP. Command:
service php5-fpm restart
APC & WordPress + WP3 Total Cache
If you are using W3 Total Cache plugin, then you must make use of APC for Database Cache and Object Cache.
Check following screenshot:
Note: W3 Total cache will offer APC storage option for Page Cache and Minify Cache also. Do NOT use it. “Disk enhanced” is better for Page Cache & Minify Cache.