如何使用Nginx禁用PHP 5(FPM)的代码缓存? [英] How do I Disable the Code Cache for PHP 5 (FPM) with Nginx?
问题描述
当我将更改保存到PHP文件然后重新加载时,无论我进行了多少次刷新,它都会继续执行脚本的旧版本一分钟左右. 1分钟左右后,它将执行当前版本.
When I save changes to a PHP file and then reload, it continues to execute the old version of the script for a minute or so regardless of how many refreshes I do. After 1 minute (or so) it executes the current version.
如何禁用此行为,以便立即进行更改?
How do I disable this behaviour so changes occur immediately?
安装程序是使用Nginx的PHP-FPM.
Setup is PHP-FPM with Nginx.
推荐答案
我的解决方案是在Zend OPCache配置中,而不是APC.
My solution was in the Zend OPCache configuration rather than APC.
我在Windows 8.1机器上安装了WNMP的原始版本(PHP 5.5.11),并在我的php.ini
文件的[opcache]
部分中发现启用了Zend OPCache,并且仅每60秒检查一次文件更改(opcache.revalidate_freq=60
).查找该配置指令并将其设置为0
,以强制OPCache在每次请求时检查php文件.
I installed the vanilla version of WNMP (PHP 5.5.11) on my Windows 8.1 box and discovered in my php.ini
file's [opcache]
section that the Zend OPCache was enabled and only checking file changes once every 60 seconds (opcache.revalidate_freq=60
). Look for that config directive and set it to 0
to force the OPCache to check php files on each request.
这篇关于如何使用Nginx禁用PHP 5(FPM)的代码缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!