10

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?

closed as too broad by kiamlaluno Jun 1 '15 at 12:19

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    In my case I found the underlying issue by adding function cache_get() { return false; } to settings.php. – guaka 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
2

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
12

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')){ 
    debug_print_backtrace(); 
}
$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

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