I am getting the following error on the server

Fatal error: Call to undefined function cache_get() in includes/module.inc on line 665
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Call to undefined function cache_get() in includes/module.inc, line 665

How to fix this?

  • 1
    In my case I found the underlying issue by adding function cache_get() { return false; } to settings.php. – kqw Jul 7 '15 at 19:12
  • 5
    In my case Ubuntu was setup to use php7 by default. Drush needs php5 assuming your server is also using php5... Try sudo ln -sfn /usr/bin/php5 /etc/alternatives/php – Jorge Orpinel Jul 16 '16 at 8:53

When you type drush in the command line you probably reached the right place to solve your problem. This error arises when drush is not up-to-date and this occurs when you install drush from the official repository in Ubuntu.

The workaround is easy: just install a new version of drush! And to do so, you have to install from the backports package of Ubuntu.

  • I also came around same solution, I am using Drush 4.6. To which version can i upgrade? – Dinesh Kumar Sarangapani Sep 18 '12 at 8:54

For me, the cause was different: some errors are not caught by Drupal's error handler.

I used a new DateTime() in my settings.php (probably very rare) It generated an error because the date.timezone setting in my CLI php.ini wasn't set.

To find the real error (this is the interesting part of the answer for all of you, I think) :

Edit your module.inc, line 723.

Add these lines before the cache_get call.

if (!function_exists('cache_get')){ 
$implementations = cache_get('module_implements', 'cache_bootstrap');

It might give you lots of information about the real source of the issue!

  • This was very useful for me, me problem was because an issue in fast404. There seems to be several ways to reach this error, this technique will help to debug. Thanks – casivaagustin Mar 28 '17 at 15:04
  • Happy to help :) – Etienne Mar 29 '17 at 7:17
  • 1
    I had a syntax error in settings.php that resulted in Fatal error: Call to undefined function cache_get(). I'd suggest those having this issue to double check their settings.php file. – ndvo Aug 15 '18 at 16:07
  • This is basically for PHP latest version issues where session.save_handler does not working. So please remove the bellow line from settings.php ini_set('session.save_handler', 'user'); or Replace the line by session_set_save_handler(new SessionHandler()); ---------------------------- Current line ini_set('session.save_handler', 'user'); Needs to Replaced by session_set_save_handler(new SessionHandler()); – tapas talukder Feb 13 at 5:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.