Turn off Caching in MAMP

Philippe picture Philippe · Jan 20, 2014 · Viewed 10.3k times · Source

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?)

Answer

Ivan Durst picture Ivan Durst · Feb 4, 2014

@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