After upgrading to 7.62, I encounter the following error in drush status and blank pages. Please help! We're not able to upgrade our production Drupal sites.
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /var/www/drupal/includes/module.inc:762
Stack trace:
#0 /var/www/drupal/includes/module.inc(962): module_implements('system_theme_in...')
#1 /var/www/drupal/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /var/www/drupal/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /var/www/drupal/includes/theme.maintenance.inc(57): list_themes()
#4 /var/www/drupal/includes/bootstrap.inc(2894): _drupal_maintenance_theme()
#5 /var/www/drupal/includes/errors.inc(179): drupal_maintenance_theme()
#6 /var/www/drupal/includes/bootstrap.inc(2622): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
thrown in /var/www/drupal/includes/module.inc on line 762
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Uncaught Error: Call to undefined function cache_get() in /var/www/drupal/includes/module.inc:762
Stack trace:
#0 /var/www/drupal/includes/module.inc(962): module_implements('system_theme_in...')
#1 /var/www/drupal/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /var/www/drupal/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /var/www/drupal/includes/theme.maintenance.inc(57): list_themes()
#4 /var/www/drupal/includes/bootstrap.inc(2894): _drupal_maintenance_theme()
#5 /var/www/drupal/includes/errors.inc(179): drupal_maintenance_theme()
#6 /var/www/drupal/includes/bootstrap.inc(2622): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
thrown in /var/www/drupal/includes/module.inc, line 762
Comments
Comment #2
ianchan commentedI think it's something in includes/bootstrap.inc
Comment #3
grahamcI've just seen this error on a site where the new
misc/typo3directory had not been deployed to the server.The issue went away when the update was deployed correctly.
Comment #4
ianchan commentedThe problem does not occur in the 7.63 release.
Thank you for the making the new release available.
Comment #5
xjmYes this sounds like a broken deployment or update, which could have happened as a side effect of the issue affecting Drush in 7.62 or something else. Thanks @grahamC and @ianchan for following up!
Comment #7
bobburns commentedI did not see where this was "fixed" - but I troubleshot my same issue by . . .
by adding function cache_get() { return false; } to settings.php - which brought up an error page that stated I could not set "user" with an ini_set in the settings.php file . . .
So I commented it out as thus . . .
# ini_set('session.save_handler', 'user');
which then came up with a "cannot" re-declare error in the log pointing to line 6 of the settings.php which was the => function cache_get() { return false; }
and when I removed it the site launched
See also https://drupal.stackexchange.com/questions/43971/fatal-error-call-to-und...
Comment #8
webchickJust confirming I had the same issue moving a site from a PHP 5 hosting situation to a PHP 7.3 hosting situation, and @bobburns's solution of uncommenting that ini_set() line in settings.php seems to have done the trick! Thanks!
Comment #9
spamator12 commentedFatal error: Uncaught Error: Call to undefined function cache_get() in /includes/module.inc:733 Stack trace: #0 /includes/module.inc(931): module_implements('system_theme_in...') #1 /modules/system/system.module(2511): module_invoke_all('system_theme_in...') #2 /includes/theme.inc(798): _system_rebuild_theme_data() #3 /includes/theme.maintenance.inc(57): list_themes() #4 /includes/bootstrap.inc(2602): _drupal_maintenance_theme() #5 /includes/errors.inc(179): drupal_maintenance_theme() #6 /includes/bootstrap.inc(2339): _drupal_log_error(Array, true) #7 [internal function]: _drupal_exception_handler(Object(ParseError)) #8 {main} thrown in /includes/module.inc on line 733nothing seems to work so far...
Comment #10
erindarri commentedAnother report of this error. Pantheon (php 7.2.12), Drupal 7.67. I don't even have the line about ini_set('session.save_handler', 'user'); in my code. I don't recall when it started, but I think it might have been around the same update as above.
Comment #11
longtom commentedgot it today in Drupal 7.67
Comment #12
jadhavdevendra commentedI faced this issue due to incorrect permission on patheon. Somehow execute permission was not set on two folders inside misc directory. I switched mode to SFTP added execute permission to them and switched back to git mode. That fixed the issue.
Comment #13
MHGR commentedI am facing the same issue in Drupal7 while upgrading php version 5.5 to 7.0.28. Please help to resolve the below issue.
Fatal error: Uncaught Error: Call to undefined function cache_get() in ...\includes\module.inc:762 Stack trace: #0 ...\includes\module.inc(962): module_implements('system_theme_in...') #1 ...\modules\system\system.module(2514): module_invoke_all('system_theme_in...') #2 ....\includes\theme.inc(798): _system_rebuild_theme_data() #3 ...\includes\theme.maintenance.inc(57): list_themes() #4 ....\includes\bootstrap.inc(2894): _drupal_maintenance_theme() #5 ....\includes\errors.inc(179): drupal_maintenance_theme() #6 ....\includes\bootstrap.inc(2622): _drupal_log_error(Array, true) #7 [internal function]: _drupal_exception_handler(Object(ParseError)) #8 {main} thrown in ...\includes\module.inc on line 762
Comment #14
navalogan commentedHi,
After the update to 7.67, i got the same issues. Someone find any solution ?
thanks
Comment #15
tpdietz commentedHi,
I also just updated to 7.67 and am having the same issue. Is there any solution to this, yet?
Thanks.
Comment #16
jadhavdevendra commentedEither uncomment below line or add if not present.
ini_set('session.save_handler', 'user');See if this helps.
Comment #17
berramou commentedHello is there is any fix for this,
I have this issue with drupal 6.67, PHP 7.1.30, i didn't have the issue with 6.66 version.
I have tried
ini_set('session.save_handler', 'user');it doesn't work.Thanks.
Comment #18
liquidcms commentedAny solution to this yet?
And on another note.. certainly seems like a step backwards as Drupal issue queue no longer allows people to change status of an issue. Clearly this issue is not closed.
Comment #19
berramou commentedFor me the issue was Fileinfo PHP extension messing, i install/enabled it on server and it works.
@liquidcms you can check with this command
php -r "var_dump(extension_loaded('fileinfo'));"Comment #20
Rafal LukawieckiThank you, @berramou and @webchick. In my case, following update to 7.67, and running on FreeBSD, it was also the missing PHP FileInfo dependency. Adding
allowed me to see the underlying error, which was reported as
I hope this helps someone.
Comment #21
DrPal43 commentedI got that issue when changing my php versions to 7.2.
7.2 doesn't use ini_set('session.save_hanlder','user') anymore.
session_set_save_handler(); is the replacement.
Hope this helps someone.
https://stackoverflow.com/questions/55785829/ini-setsession-save-handler...
Comment #22
DrPal43 commentedphp 7.2 doesn't like ini_set('session.save_handler', 'user'); in the settings.php.
replace:
ini_set('session.save_handler', 'user');
with:
session_set_save_handler(new SessionHandler());
This fixed the issue.
Comment #23
gramie commented@berramou, thank you for finding that! It was the problem for me too. Once I enabled fileinfo, everything worked!
Comment #24
dexnob commented@DrPal43 thanks, that worked for me #21
Comment #25
alfthecat commentedAdding session_set_save_handler(new SessionHandler()); to settings.php as mentioned in #22 fixed the issue for me. Thanks @DrPal43!!!
Comment #26
Studio FJ commentedMy site is Drupal 7.69 started having this same issue today. My settings.php file does not have:
ini_set('session.save_handler', 'user');
I downloaded a fresh Drupal core and do not see that line in default.settings.php either. Where is that code normally located?
Notes:
1) Fileinfo PHP is enabled
2) My php version is 7.3 and has been since it's release
3) I do not have Drush installed on my server
4) I updated to Drupal 7.69 with no issues earlier this month
5) The site randomly went down today
PHP Fatal error: Uncaught Error: Call to undefined function cache_get() in /public_html/includes/module.inc:762
Stack trace:
#0 public_html/includes/module.inc(962): module_implements('system_theme_in...')
#1 public_html/modules/system/system.module(2518): module_invoke_all('system_theme_in...')
#2 public_html/includes/theme.inc(798): _system_rebuild_theme_data()
#3 public_html/includes/theme.maintenance.inc(57): list_themes()
#4 public_html/includes/bootstrap.inc(2896): _drupal_maintenance_theme()
#5 public_html/includes/errors.inc(179): drupal_maintenance_theme()
#6 public_html/includes/bootstrap.inc(2621): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
thrown in public_html/includes/module.inc on line 762
Comment #27
alfthecat commentedHi @Studio FJ,
I experienced the same thing, this happened suddenly yesterday.
Just add the following line to your settings.php:
session_set_save_handler(new SessionHandler());If you have drush, flush your site's caches via the command line.
Comment #28
hughworm commentedTo overcome this I've gone simple and added
at line 762 of module.inc, just before it uses cached_get().
Seems to have fixed it (I also had to change the session handler thing).
Comment #29
alfthecat commentedAfter running into this issue again, even with the
session_set_save_handler(new SessionHandler());added to settings.php, adding the solution in #28 from @hughworm solved it.BTW, shouldn't this issue be an active bug report?
Comment #30
scottop commentedfrom @drpal43, comment 22. This worked for me. Thank you.
Comment #31
tapas_talukder commentedThis is basically for PHP latest version issues where session.save_handlerdoes 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());
Comment #32
kropotkinthinks commentedThe solution from @DrPal43 worked for me too. I did the following, in settings.php:
#ini_set('session.save_handler', 'user');
session_set_save_handler(new SessionHandler());
Commented out the ini_set for session.save_handler and added the session_set_save_handler
Comment #33
hassan.farooq121 commented#8 worked for me
Comment #34
shaesenphp 7.2 doesn't like ini_set('session.save_handler', 'user'); in the settings.php.
replace:
ini_set('session.save_handler', 'user');
with:
session_set_save_handler(new SessionHandler());
This solved it for me too !
Stefaan
Comment #35
mchaplin commentedI found the position of the
session_set_save_handler(new SessionHandler());
in the file to be critical.
It worked for me when placed AFTER all the ini_set statements.
Comment #36
andresc75 commented- Updated to 7.71 (from 7.67) with no errors,
- Upgraded php to 7.2 (from 5)
RESULT: Site returned error 500
Add these lines of code to "index.php"
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
and get "Call to undefined function cache_get() in /var/www/drupal/includes/module.inc:762" (following other errors)
Modified setting.php as described in #22 SOLVED MY PROBLEM
Thank you!
Comment #37
andrewmk commentedAnd for me it was a missing memcached extension for php. Adding:
To the beginning of settings.php let me see the actual error which was:
<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>Error: Class &#039;Memcached&#039; not found in include_once()(Don't forget to remove the dummy cache_get after you've fixed the problem!)
Comment #38
twfahey commentedJust adding my story on this error for any future explorers -- In my case, I had neglected a ";" at the end of my settings.local.php file, and this was what wound up manifesting as the error! I would have expected invalid syntax or some other more pointed error, but obviously a very rare edge case! I just happened to be adding in a `$base_url` for this D7 site, and was moving too quickly and forgot my semicolon, so it might be the easy answer for some :)
Comment #39
sam-elayyoub commentedI got to this issue for one of my sites after upgrading the server to 7.4
quick Solution:
I changed line 57 in includes/cache.inc to return false instead of the cache id.
Comment #40
subir_ghoshI removed
ini_set('session.save_handler', 'user');And it worked.
Phew! What a relief. Thanks everyone.
Comment #41
rfayMy experience was odd and similar to @twfahey in https://www.drupal.org/project/drupal/issues/3026449#comment-13931291 - It was a simple syntax error in generated (development) settings.ddev.php. I had a double-quote after the driver statement, a complete syntax error, and ended up with this stack trace instead of anything useful.
Comment #42
ressaThanks @Rafal Lukawiecki. My Drupal 7 site WSOD'ed after upgrading to PHP 8.1. With
function cache_get() { return false; };at the top of settings.php I could see theUndefined constant PDO::MYSQL_ATTR_SSL_CA in Drush\Sql\Sqlmysql->creds()error, so I could install the missing PHP package. Here are the packages I needed:Comment #43
bburgThere seems to be two causes of this issue. One, being when you upgrade to PHP7, you need to change
with:
I hope most people are on PHP 7 by now though...
The other cause is when you have a syntax error in your settings.php file. This was the case for me, and the settings file was out of version control on this particular site, so my IDE never had a chance to catch it.
I was able to validate the file on the sever with the command line
php -l settings.phpComment #44
keypetery commented#22 and #43 worked for me.
Running D7.94
Shared hosting service had recently updated to PHP 8.1
Changed settings.php as follows and error warning disappeared:
# ini_set('session.save_handler', 'user');session_set_save_handler(new SessionHandler());Thanks DrPal43 and bburg!