在 MAMP 中停止缓存 PHP 5.5.3 [英] Stop caching for PHP 5.5.3 in MAMP

查看:34
本文介绍了在 MAMP 中停止缓存 PHP 5.5.3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有 PHP 5.5.3 的新 Macbook 上安装 MAMP.

Installed MAMP on a new Macbook with PHP 5.5.3.

重新加载和刷新什么都不做.依然没有.谷歌几分钟试图找出问题所在,回来刷新.有用.有没有搞错?

Reload and refresh do nothing. Still nothing. Google around for a few minutes trying to find out what is wrong, come back and refresh. It works. What the heck?

我进入 php.ini 并禁用所有新的 OPcache 并将默认缓存时间设置为 0.向文档添加标题以强制不缓存.还是一样的问题.这到底是怎么回事?

I went into php.ini and disabled all the new OPcache and set the default cache time to 0. Added headers to the document to force no caching. Still same problem. What the heck is going on here?

网络选项卡显示 HTTP 200 请求,因此 index.php 文件中的任何新 HTML 都可以正常呈现,但需要由服务器呈现的新 PHP 被延迟并且直到一些预定的时间过去了,我不知道如何改变.怎么回事?

The network tab is showing a HTTP 200 request, so any new HTML in the index.php file renders fine, but new PHP that needs to be rendered by the server is delayed and not rendered until some predetermined set of time passes that I don't know how to change. What's going on?

我也在 Safari 中检查了这个,所以它肯定是服务器的事情阻止了文件的呈现.

I checked this in Safari too so it is definitely a server thing that is keeping the file from rendering.

有趣的事实是,如果我进入 MAMP 并将 PHP 版本更改为旧版本(PHP 5.2 或其他版本),它将正常呈现,没有缓存问题".切换到 PHP 5.5,它挂了.在 MAMP 首选项中,5.5 的缓存选项甚至不存在并且会自动禁用.

Interesting fact though, if I go into MAMP and change the PHP version to the old one (PHP 5.2 or something) it will render normally, with no "caching issues". Switch to PHP 5.5 and it hangs up. In the MAMP preferences caching options for 5.5 don't even exist and are automatically disabled.

推荐答案

禁用 OPCache

MAMP 现在默认开启 OPCache,你可以通过编辑你的 php.ini 文件来禁用它.确保您编辑了正确的 php.ini.

MAMP now turns on OPCache by default, you can disable it by editing your php.ini file. Make sure you edit the correct php.ini.

我自己也遇到了同样的问题.默认情况下,PHP 5.5.3 版的 MAMP 运行 OPcache,但您无法像使用旧版 PHP 5.2.17 那样在 GUI 中关闭它.您必须手动注释掉 php.ini 文件(MAMP/bin/php/[version]/conf/php.ini)末尾的所有 OPcache 行,并确保停止和启动服务器以进行更改效果.

I was running into the same problem myself. MAMP with PHP version 5.5.3 runs OPcache by default, but you can't turn it off in the GUI like you can with the older PHP version 5.2.17. You have to manually comment out all the OPcache lines at the end of the php.ini file (MAMP/bin/php/[version]/conf/php.ini) and make sure to stop and start the servers for the changes to take effect.

我更新了 URI,更改也可以通过更改 php 文件夹下的/conf/来反映,但似乎 MAMP 在重启后会忽略这些.

这篇关于在 MAMP 中停止缓存 PHP 5.5.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆