Open main menu

Changes

235 bytes added ,  13:25, 19 March 2018
added links
Meza installs <code>php56u-opcache</code> in <code>/opt/meza/src/roles/apache-php/tasks/php.yml</code> and sets <code>opcache.interned_strings_buffer=4</code> in /opt/meza/src/roles/apache-php/templates/php.ini.j2</code>
In raising the setting we also optimized the PHP opcache according to the '''[https://www.scalingphpbook.com/blog/2014/02/14/best-zend-opcache-settings.html Scaling PHP]''' book recommendations.
Also, in order to effectively monitor our actual usage of the Opcache, I installed Rasmus Ledorf's (creator of PHP): [https://github.com/rlerdorf/opcache-status.git opcache-status] for instances where the deploy mode is 'development'. Note: There are a few (simple+good) pull requests that have sat idle for a long time, so it might be better to use a fork, or create a fork instead of using Rasmus' repo.
Opcache status does reveal document root and physical script path information so it's best to keep it 'private' (hence why we only install it in development). I've left out details on installation e([https://github.gcom/rlerdorf/opcache-status/pull/50/files see example]). and Apache configuration to restrict access to opcache.php.
<code>Opcache.max_accelerated_files</code> should be larger than the number of files in your project. We have ~7455, <ref>
</ref> and the next prime number is 7963. So let's set it to 7963 (currently 20,000)
One big change recommended by the book is to never re-validate file timestamps in production...it's wasting valuable time with stat calls. Instead, the book says re-validate in the dev environment, and whenever you push to production, [https://www.cyberciti.biz/faq/unix-linux-restart-php-service-command/ restart your webserver].
<blockquote>
"Yes, this is a pain in the ass, but you should use it. Why? While you're updating or deploying code, new code files can get mixed with old ones— the results are unknown. It's unsafe as hell."