Search code examples
databasecodeignitercachingcodeigniter-2

Codeigniter query caching causes Blank Screen


I have run into a strange issue. I had set these parameters in my database.php file as per following:

$db['default']['cache_on'] = TRUE;

$db['default']['cachedir'] = 'cache';

After this the db cache started working just fine. Then to test, I simply deleted all files in the cache folder and tried to refresh my page but the site went blank.

Even error log is showing nothing. Then I disabled cache by setting it "False", site started to work just fine again.

Can somebody advise me what could be the issue? Whenever I set it to "True" again the site goes blank.

Thanks!


Solution

  • Specify the cache directory path.

    $db['default']['cache_on'] = FALSE;
    $db['default']['cachedir'] = './my_cache/'
    

    So all cache files for the particular page will be stored here.

    And I recommended you to enable db_debug as follows so the error will be shown if any in Query

    $db['default']['db_debug'] = TRUE;
    

    For More details, you can refer here : http://ellislab.com/codeigniter/user-guide/database/caching.html