Installing php apc with homebrew

I’ve been enjoying using the keg homebrew-php by josegonzalez in order to run the latest versions of PHP, like PHP 5.4 on Mac running OS X 10.8 Snow Leopard.

I also like to use Ubuntu on some cloud web servers and have been noticing a huge improvement in performance when the php module apc is installed / enabled.

Recently I learned that I can get this same performance boost on in my development environment on my mac by using apc here too.

Just install it with homebrew:

 brew install php54-apc

The module will be installed and enabled, and on my system it created a new config file called ext-apc.ini in the directory /usr/local/etc/php/5.4/conf.d and it has some great defaults:

[apc]
extension="/usr/local/Cellar/php54-apc/3.1.10/apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=64M
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=0

One key here is that apc.shm_size needs to be set, and that it also needs to have the suffix M or I guess you could use K if you wanted a really small shm_size but honestly 64M works pretty great.

Related Posts:

  • No Related Posts
This entry was posted in Mac, Web Development and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *