Table of Contents

Installing/Enabling APC on a Joyent Accelerator

As of Accelerator Revision 2.0.7 you no longer need to install APC from scratch. However, you do need to enable it and configure it. So, be mindful of that please.

Enable and Configure APC for Accelerator 2.0.7 or greater

Preparation. Log in as the default shell user and configure PHP for APC.

Configure PHP

Enable APC in php.ini

sudo nano /opt/local/etc/php.ini
edit /opt/local/etc/php.ini on webservers
find: ;extension=apc.so
change to: extension=apc.so

simply remove the semicolon to “turn on” APC.

The following configuration does require some tuning depending on the size of your accelerator, what you are doing with APC, and nature of your applications and may change over time. But, this is a good starting point.

Add APC Configuration to php.ini

At the very bottom of your existing /opt/local/etc/php.ini file you need to add the following entry for APC.

[APC]
;specifies the size for each shared memory segment 8MB to start
apc.shm_size=8
;max amount of memory a script can occupy
apc.max_file_size=1M
apc.ttl=0
apc.gc_ttl=3600
; means we are always atomically editing the files
apc.file_update_protection=0
apc.enabled=1
apc.enable_cli=0
apc.cache_by_default=1
apc.include_once_override=0
apc.localcache=0
apc.localcache.size=512
apc.num_files_hint=1000
apc.report_autofilter=0
apc.rfc1867=0
apc.slam_defense=0
apc.stat=1
apc.stat_ctime=0
acp.ttl=7200
apc.user_entries_hint=4096
apc.user_ttl=7200
apc.write_lock=1

Add the APC Dashboard

Download the APC package from http://pecl.php.net/package/APC. In side that package there is a file called “apc.php”

Place apc.php in your default web directory so you can go to http://yoursite.com/apc.php There you will see a nice APC dashboard that has lots of handy features.

You should probably password protect that page.

Restart Web Server

sudo svcadm restart http