Enable PHP 5.5 Opcache on Ubuntu 14.04 with Nginx and PHP-FPM

Making the switch from APC to Opcache now that it’s standard with Ubuntu 14.04. All the tutorials seemed to be on Apache so thought I’d share what I did. The first change and restarting php I believe is all you need to do while the other changes are for performance and will vary based on your needs. If others have recommendations or additional advice please pipe in!

sudo vim /etc/php5/fpm/php.ini

Change: ;opcache.enable=0 to opcache.enable=1

Change: ;opcache.memory_consumption=64 to opcache.memory_consumption=128

Change: ;opcache.max_accelerated_files=2000 to opcache.max_accelerated_files=4000

Change: ;opcache.revalidate_freq=2 to opcache.revalidate_freq=60

Then restart: sudo service php5-fpm restart

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, I have opcache up and running but there is no files cached. There is a lot of misses and blacklist misses but no cached keys and no cached scripts. What could be wrong?

How do we verify if its working??

hi @asb , i have one question, should that configuration suite small droplets like 512 as well?

and thx for the info by the way @chris324769