Home » Php » php – Disabling cache on CakePHP 2.4.4

php – Disabling cache on CakePHP 2.4.4

Posted by: admin July 12, 2020 Leave a comment


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';
How to&Answers:

and may be in

comment out the line in this block!

spent three days on this


in app/Config/core.php

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

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


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

So in your controller:


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.


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.