Enabling OPcache for PHP 5.6+ installed with Homebrew


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!


  1. You need to install the php-opcache package for some time now (since OS X 10.11 El Capitan I think): brew install

    Then you need to enable it in the opcache section of your php.ini: opcache.enable=1

    Finally, restart your PHP-FPM or your Apache.


Leave a Reply