Question

Configure & tune opcache on php7

Hi, as written on subject, how can i configure opcache on php 7 and what should be the optimized configuration for 10$ droplet?

thanks in advance.

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.

@newbie

Normally I use something like:

opcache.revalidate_freq=0
opcache.validate_timestamps=0 (comment this out in your dev environment)
opcache.max_accelerated_files=7963
opcache.memory_consumption=192
opcache.interned_strings_buffer=16
opcache.fast_shutdown=1

Which is from:

https://www.scalingphpbook.com/blog/2014/02/14/best-zend-opcache-settings.html

Depending on file count, you may need to increase opcache.max_accelerated_files. That said, the above is allocating up to 192MB, which may be excessive depending on your application. If you find that to be high (i.e. you’re only using 25% of that at any give time), you can reduce that down further.