On a Unix machine with PECL installed you can get APC by running the command 

sudo pecl install apc

Once the automated setup is done you must complete the installation by editing the php.ini file. The minimal required settings are as follows:

extension=apc.so
apc.stat=1
apc.enabled=1

The last line takes value 1 or 0 to enable or disable the opcode caching.

Optionally, if you want to configure more, settings are as follows:

[APC]
extension = apc.so
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128
apc.optimization = 0
apc.num_files_hint = 1024
apc.user_entries_hint = 1024
apc.ttl = 0
apc.user_ttl = 0
apc.gc_ttl = 600
apc.cache_by_default = 1
apc.filters = "apc\.php$"
apc.slam_defense = 0
apc.use_request_time = 1
apc.mmap_file_mask = /tmp/apc-yourusernamehere.XXXXXX OR /dev/zero
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 5M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
apc.rfc1867 = 0
apc.rfc1867_prefix = "upload_"
apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
apc.rfc1867_freq = 0
apc.localcache = 1
apc.localcache.size = 512
apc.coredump_unmap = 0
apc.stat_ctime = 0

 

While APC is enabled, now to test a product page, type in terminal:

sudo ab -n 1000 -c 5 http://local.test.com/sony-vaio-vgn-txn27n-b-11-1-notebook-pc.html

To visualize the APC caching impact on a Magento store let’s use the APC management tool that becomes available once the APC is installed. A file called apc.php can be found under /usr/share/php/apc.php. Copy this file into web server root directory so that it can be called by its URL in a browser i.e.

http://local.test.com/apc.php

And the output will be as below:

 

 

php apc

 

Categorized in: