If you use Dreamhost as your hosting provider, and more specifically, use their shared hosting service, you may notice that PHP performance is less than ideal. Luckily, Dreamhost gives one possible option to increase performance: installing and configuring APC (Alternative PHP Cache).
Before we begin, please note this is for advanced users only. You must meet these requirements to complete the install:
These are the steps to install and configure APC:
3. Paste the following **after** the _extension_ line (be sure to edit apc.filters with the path to your webroot): ```bash \[APC\] extension = apc.so apc.enabled = 1 apc.shm\_segments = 1 apc.shm\_size = 32M apc.optimization = 0 apc.num\_files\_hint = 512 apc.user\_entries\_hint = 1024 apc.ttl = 0 apc.user\_ttl = 0 apc.gc\_ttl = 600 apc.cache\_by\_default = 0 apc.filters = "-/home/yourusername/yourwebsite.com/apc\\.php$" apc.slam\_defense = 0 apc.use\_request\_time = 1 apc.mmap\_file\_mask = /tmp/apc-accountname.XXXXXX ;OR apc.mmap\_file\_mask = /dev/zero apc.file\_update\_protection = 2 apc.enable\_cli = 0 apc.max\_file\_size = 2M 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
bash cp ~/download/APC-3.1.9/apc.php ~/yourwebsite.com/apc.php
6. Open top: ```bash top
bash killall php53.cgi
Run that command a few times until you receive a "php53.cgi: no process found" message. 8. Navigate to yourwebsite.com/apc.php to see the status of APC: [![apc](http://assets.brandonmartinez.com/brandonmartinez/2013/03/apc-575x352.png)](http://assets.brandonmartinez.com/brandonmartinez/2013/03/apc.png) Ideally, your fragmentation should be under 50%. 9. If all looks well, remove the apc.php file from your site: ```bash rm ~/yourwebsite.com/apc.php
There are many benefits to using APC, especially when you use it in conjunction with applications like WordPress. In my next post, I'll show you how to configure WordPress and W3 Total Cache to get the best performance from your WordPress application on Dreamhost shared hosting.