Enabling Zend OPcache on Ubuntu and Apache

opcodeZend OPcache is the new open source opcode PHP cache that is now bundled with PHP 5.5. I had just upgraded one of my servers running Ubuntu 12.04 to use Apache 2.4.6 and PHP 5.5.4.

So how does one install it? I initially thought I had to just edit the php.ini file since there are a bunch of new settings for the opcache. I set mine similar to the recommended default and did not enable `cli` caching.

opcache.memory_consumption=128
opcache.interned_strings_buffer=6
opcache.max_accelerated_files=2000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Restarting Apache however and I saw that it was still disabled , even though I had also set

opcache.enable=1

A quick poking around the /php5 dir and I could see there was an opcache.ini set under /php5/mods-available which called the extension. This should work but to be honest what is a /mods-available doing in /php5 ? I guess this is something new. A quick look for the actual extension showed that the opcache.so was in /usr/lib/php5/.

Th good news was that everything was there and to enable it I just had to add a full link to

zend_extension=/usr/lib/php5/"some numerical dir"/opcache.so

and reboot Apache.

This is pretty much exactly what is says on http://php.net/manual/en/book.opcache.php but for some reason I could not read it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s