Enabling OPcache for PHP 5.6+ installed with Homebrew

PHP

Since 5.5, PHP comes with a built-in OPcache system. This PHP accelerator has been open sourced by Zend and is a good replacement for APC.

If you installed PHP 5.6 on your Mac with Homebrew, you maybe noticed that OPcache is not enabled by default. Even if the extension has been compiled, a manual configuration must be done to enable the extension.

  1. Open /usr/local/etc/php/5.6/php.ini
  2. Add zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/opcache.so at the end of this file
  3. Restart your PHP FPM or Apache if you are using mod_php

You’re dev environment is now blazing fast!