Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Facile.it Engineering Blog:
Is it all PHP OPCache's fault?
Oct 05, 2017 @ 15:49:39

In a new post to the Facile.it Engineering Blog author Salvatore Cordiano wonders if it's all PHP OpCache's fault when it came to an issue they were seeing post-deploy.

Upon migrating to a new infrastructure we started experiencing cache issues after each deploy: as we refreshed pages that were updated by the new release, we didn’t see the right content for a very short period of time. Initially, we wrongly assumed that the cause of this issue was the PHP OPcache extension but, after our investigation, we understood that real path cache was the culprit.

He starts from the beginning (a good place to start) and gives some background on the application they were working with and what they were trying to correct. After they deployed the newly pushed version wouldn't show when the pages loaded for a little while. He covers the deployment process they use and the commands/scripts they use. They started wondering if it was somehow PHP's own Opcache functionality that was caching the pages and not releasing them right away. They made some updates to their deployment process to try to resolve this.

After some investigation, however, it was discovered that the realpath caching was at fault. It wasn't updating the cache to point to the newly released files. In order to correct the issue, they tinkered with the php.ini settings related to the cache to disable it when the code is pushed.

tagged: opcache realpath cache deployment issue tutorial

Link: https://engineering.facile.it/blog/eng/realpath-cache-is-it-all-php-opcache-s-fault/


Trending Topics: