Question

Trying to turn off caching in MAMP for development, waiting for cache to expire after making small changes is killing my productivity. (Problem started when I changed to PHP 5.5.3, changing back doesn't fix it)

After researching I've taken the following steps to (unsuccessfully) disable cache:

Commented out OPcache lines in php.ini and reset mamp. (and tried zero values shown)

;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

added PHP headers

   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");

added html headers

<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" />

I'm also using the option in google chrome to turn off caching when dev tools are open.

I'm lost here, can't think of anything else I can do to disable cache.

After changing PHP - OR - HTML code I have to wait about 2 mins for it to take effect. However database changes seem to take effect immediately so I think its a server side opcache.

Is there another cache that MAMP uses that I need to disable? (or a different step?)

Was it helpful?

Solution

@Philippe, Ensure you commented out OPcache in

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

not the one in

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

OTHER TIPS

Fast-forwarding to 2022, MAMP now has this as a UI option.

For anyone on MAMP Pro for OSX (Monterey), the PHP setting can be accessed through the "View Mode" toggle (to "Expert" mode). By default, it's set to "Standard" mode and hides many of these options.

Click on the PHP tab in the left column, then go to dropdown with "Cache module to speed up execution". Select "off".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top