停止在MAMP中为PHP

停止在MAMP中为PHP

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

问题描述

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

Installed MAMP on a new Macbook with PHP 5.5.3.

重新加载和刷新不执行任何操作.依然没有. Google绕了几分钟,试图找出问题所在,然后回来刷新.有用.有没有搞错?

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似乎在重启后会忽略它们.

I updated the URI, the changes can be reflective by also changing /conf/ under the php folder, but it seems MAMP will ignore these after restart.

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

07-25 19:09