Sometimes I like to use PHP's built-in development server to work on quick stuff like so:
有时我喜欢使用PHP的内置开发服务器来处理快速的东西:
php -S 127.0.0.1:8888
However I seem to run into heavy caching issues from time to time where I need to restart the server in order to see even simple HTML changes.
但是我似乎经常遇到严重的缓存问题,我需要重新启动服务器才能看到简单的HTML更改。
I haven't been able to find any options to disable this or otherwise pinpoint what might be causing this frustration.
我无法找到任何禁用此选项或以其他方式查明可能导致这种挫败感的选项。
Note: I usually have Chrome's Developer Tools open with browser caching disabled while I'm doing this. I don't think it's a browser caching issue.
注意:我通常在我执行此操作时打开Chrome浏览器缓存禁用浏览器缓存的工具。我不认为这是一个浏览器缓存问题。
Is there anything I can try?
有什么我可以尝试的吗?
1 个解决方案
#1
1
If modifying your php scripts isn't resulting in a change, it could be a problem with opcode caching as opposed to browser caching (browser caching should be easily overridden by CTRL-F5
or CTRL-R
, depending on your OS). This happens when the server is pre-compiling your php code to speed up responses.
如果修改你的php脚本没有导致更改,那么操作码缓存可能会出现问题而不是浏览器缓存(CTRL-F5或CTRL-R应该很容易覆盖浏览器缓存,具体取决于你的操作系统)。当服务器预编译您的PHP代码以加快响应时,会发生这种情况。
This was the case with me, so I went in to /etc/php5/cli/conf.d/
and found the symlink to 05-opcache.ini
and deleted that symlink, and restarted the builtin server. The problem where pages wouldn't change when I made edits to php code was resolved from that point onwards.
这就是我的情况,所以我进入了/etc/php5/cli/conf.d/并找到了05-opcache.ini的符号链接并删除了该符号链接,并重新启动了内置服务器。从那时起,解决了当我对php代码进行编辑时页面不会改变的问题。
#1
1
If modifying your php scripts isn't resulting in a change, it could be a problem with opcode caching as opposed to browser caching (browser caching should be easily overridden by CTRL-F5
or CTRL-R
, depending on your OS). This happens when the server is pre-compiling your php code to speed up responses.
如果修改你的php脚本没有导致更改,那么操作码缓存可能会出现问题而不是浏览器缓存(CTRL-F5或CTRL-R应该很容易覆盖浏览器缓存,具体取决于你的操作系统)。当服务器预编译您的PHP代码以加快响应时,会发生这种情况。
This was the case with me, so I went in to /etc/php5/cli/conf.d/
and found the symlink to 05-opcache.ini
and deleted that symlink, and restarted the builtin server. The problem where pages wouldn't change when I made edits to php code was resolved from that point onwards.
这就是我的情况,所以我进入了/etc/php5/cli/conf.d/并找到了05-opcache.ini的符号链接并删除了该符号链接,并重新启动了内置服务器。从那时起,解决了当我对php代码进行编辑时页面不会改变的问题。