12
votes

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

1
It's been over a week, and not even a suggestion? Same problem here... @Philippe, just to make sure we're on the same page, 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. This is according to Husky's comment here: stackoverflow.com/questions/19073270/… - Ivan Durst
@IvanDurst I had commented it out here, /Applications/MAMP/conf/php5.5.3/php.ini not here /Applications/MAMP/bin/php/php5.5.3/conf/php.ini commenting out in the second location solved my problem put it as in answer and I will mark as accepted! - Philippe
update: commenting out opcache here /Applications/MAMP/bin/php/php5.5.3/conf/php.ini and restarting apache solved my problem - still works without caching when I commented out the PHP headers and the meta no cache tags. - Philippe

1 Answers

8
votes

@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