关闭 MAMP 中的缓存

问题描述 投票:0回答:3

尝试关闭 MAMP 中的缓存进行开发,在进行小更改后等待缓存过期会降低我的工作效率。 (当我更改为 PHP 5.5.3 时出现问题,更改回来并不能解决它)

经过研究,我采取了以下步骤来(未成功)禁用缓存:

注释掉 php.ini 中的 OPcache 行并重置 mamp。 (并尝试显示零值)

;zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
;  opcache.memory_consumption=0
;  opcache.interned_strings_buffer=0
;  opcache.max_accelerated_files=0
;  opcache.revalidate_freq=0
;  opcache.fast_shutdown=1
;  opcache.enable_cli=0

添加了 PHP 标头

   header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
   header("Cache-Control: post-check=0, pre-check=0", false);
   header("Pragma: no-cache");

添加了 html 标题

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />

我还使用 google chrome 中的选项在开发工具打开时关闭缓存。

我在这里迷路了,想不出我还能做些什么来禁用缓存。

更改 PHP - OR - HTML 代码后,我必须等待大约 2 分钟才能生效。然而数据库更改似乎立即生效,所以我认为它是服务器端 opcache。

我需要禁用 MAMP 使用的另一个缓存吗? (或不同的步骤?)

php caching mamp opcache
3个回答
14
投票

@Philippe,确保您在

中注释掉了 OPcache

/Applications/MAMP/bin/php/php5.5.3/conf/php.ini

不是

中的那个

/Applications/MAMP/conf/php5.5.3/php.ini


8
投票

快进到 2022 年,MAMP 现在将其作为 UI 选项。

对于 OSX(蒙特雷)MAMP Pro 上的任何人,都可以通过“查看模式”切换(至“专家”模式)访问 PHP 设置。默认情况下,它设置为“标准”模式并隐藏其中许多选项。

单击左栏中的 PHP 选项卡,然后转到“缓存模块以加速执行”下拉列表。选择“关闭”。


0
投票

在 MAMP 版本 6.8 中,您可以在 MAMP 主窗口中找到它。 “首选项”选项,“常规”选项卡:

© www.soinside.com 2019 - 2024. All rights reserved.