7
votes

I've read a bunch of Stackoverflow questions with the same goal: disabling cache in the CakePHP framework. However, none of these solutions has worked for me unfortunately.

My core.php now has these values, but the caching of controllers and views is still unbearably long for development:

Configure::write('debug', 2);
Configure::write('Cache.disable', true);
$duration = '+1 day';
if (Configure::read('debug') > 0) {
    $duration = '+1 seconds';
}
4
That's not how it is done in CakePHP. Use the response class. - mark

4 Answers

12
votes

Applications/MAMP/bin/php/php5.5.3/conf/php.ini and may be in /Applications/MAMP/conf/php5.5.3/php.ini

comment out the line in this block! [OPcache]

spent three days on this

6
votes

in app/Config/core.php

enable Configure::write('Cache.disable', true);

worked for me. after this no models and persistent cache generating.

4
votes

See http://book.cakephp.org/2.0/en/controllers/request-response.html#CakeResponse::disableCache

So in your controller:

$this->response->disableCache();

either globally via beforeRender callback, or specifically per action.

Note that for IE8 comp. regarding this you might need to add an additional header as shown here.

0
votes

It turns out it was an issue with MAMP / PHP. MAMP was set to PHP 5.5.3. After downgrading to version 5.2.17 the caching problem has been solved.