Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I git pull'd drupal 8 5 minutes ago, and I got this error PHP Fatal error: Call to a member function get() on a non-object
in my logs.
Regards,
Comments
Comment #1
BoobaaI can confirm this, and I have a stack trace as well:
These lines have been added to my apache's error.log right at the first screen of the installer, the language selector.
Comment #2
KartagisComment #3
BoobaaIt looks like if the bootstrap can't find settings, then it goes down till \Drupal\Component\PhpStorage\PhpStorageFactory::get() which tries to build a $configuration array using drupal_get_hash_salt(), which in turn tries to use the not-yet-existing settings, so it throws a RuntimeException with message being "Missing $settings['hash_salt'] in settings.php." – of course it's missing, since it hasn't been created yet.
Comment #4
znerol CreditAttribution: znerol commentedDisable the error handler and exception handler when you experience errors in an early bootstrap phase. They currently trigger errors on their own and by doing so will hide the underlying cause.
The error and exception handlers are set in
core/includes/bootstrap.inc
, lines in_drupal_bootstrap_configuration
. Disable them by commenting out the following lines:Comment #5
tim.plunkettDid you try rebuilding first? See core/rebuild.php or drush cr.
Comment #6
KartagisOkay,
I git pull'd drupal 8 a minute ago, and this is what I got when I did drush cr
Regards,
Comment #7
tim.plunkettThis is the key:
PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.' in /var/www/drupal-8/core/includes/bootstrap.inc:1497
Reinstall, and be sure to start with a fresh copy of settings.php
Comment #8
KartagisI have
cp sites/default/default.settings.php sites/default/settings.php
in my alias for pulling d8.Comment #9
pkosenko CreditAttribution: pkosenko commentedI got this same error when I tried updating an older Drupal 8 according to the protocol laid out in upgrade.txt, which is pretty much the Drupal 7 method. I wanted to test if upgrading rather than reinstalling would work. But maybe it is not related to upgrade at all?
However, a fresh installation worked fine. Just the upgrade attempt failed.
It may be that upgrade is just not on a critical path at the moment?
************
Upgrade attempt:
[28-Mar-2014 12:11:15 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in . . \drupal8\core\lib\Drupal.php on line 275
GIT pulled Drupal 8 yesterday (3/27/2014) at about 8:45 p.m.
The only detectable change in the settings.php was
$drupal_hash_salt = '';
changed to
$settings['hash_salt'] = '';
So I moved that salt value over to the settings.php and added the database configuration items.
I set the free upgrade access setting.
Database was old.
Tried to access the site, got fatal error.
*****************
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal.php on line 275
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Stack trace:
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 1. {main}() C:\Users\pkosenko\Documents\My Web Sites\drupal8\index.php:0
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 2. drupal_handle_request() C:\Users\pkosenko\Documents\My Web Sites\drupal8\index.php:15
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 3. Drupal\Core\DrupalKernel->boot() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1455
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 4. Drupal\Core\DrupalKernel->initializeContainer() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DrupalKernel.php:177
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 5. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DrupalKernel.php:417
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 6. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 7. service_container_prod->getConfig_FactoryService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 8. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1260
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 9. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 10. service_container_prod->getConfig_StorageService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 11. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1299
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 12. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 13. service_container_prod->getCache_ConfigService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 14. Drupal\Core\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1048
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 15. Symfony\Component\DependencyInjection\Container->get() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal\Core\DependencyInjection\Container.php:21
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 16. service_container_prod->getCacheFactoryService() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\vendor\symfony\dependency-injection\Symfony\Component\DependencyInjection\Container.php:312
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 17. Drupal\Core\Cache\CacheFactory->__construct() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:1178
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 18. _drupal_error_handler() C:\Users\pkosenko\Documents\My Web Sites\drupal8\sites\default\files\php\service_container\service_container_prod.php\ee4db37c805b53cf4742077273a172eb73b456ffe9176c517d4806dfced83e52.php:32
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 19. _drupal_error_handler_real() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1519
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 20. _drupal_log_error() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\errors.inc:79
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 21. drupal_maintenance_theme() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\errors.inc:135
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 22. _drupal_maintenance_theme() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\bootstrap.inc:1865
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP 23. Drupal::config() C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\includes\theme.maintenance.inc:58
[28-Mar-2014 12:04:33 America/Los_Angeles] PHP Fatal error: Call to a member function get() on a non-object in C:\Users\pkosenko\Documents\My Web Sites\drupal8\core\lib\Drupal.php on line 275
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm mentoring someone who is experiencing this issue on their first D8 install, we have reinstalled to no avail. We need to have the ability to drush so we can test the migration path.
The configuration is a Mac using MAMP and it produces an error that suggests looking at #1428638: Forcing 127.0.0.1 instead of localhost for drush, however, it does not look like there is a problem based on what I'm seeing in the /etc/hosts file.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedWe figured it out. If you run drush sql-cli against D7 it will give you an error something like "mysql not found" and it turns out that running "which mysql" in fact did not produce anything.
So we had to update the $PATH environment variable for the terminal. In this case we put it into .bash_profile, adding the following path:
/Applications/MAMP/Library/bin
Then after adding this to the path we closed the terminal and opened a new session, typed "env" to confirm that the item now appears in the path.
Another solution is to install Acquia Dev Desktop: http://drupal.org/dctdi
Comment #12
manasiv CreditAttribution: manasiv commentedThanks Ryan. Your solution in #11 worked. mysql was missing from my path variable on windows 7.
I am using wamp, drush and git bash
Updating the path variable fixed the error.
Comment #13
wanflap CreditAttribution: wanflap commentedHi Kartagis,
I have the same errors on my Ubuntu instance. How did you get yours fixed?
Comment #14
Kartagis@wanflap, the error still stands on my CentOS VPS, however it doesn't stop you from installing.
Comment #15
Toche CreditAttribution: Toche commentedI´m Using MAMP 2.1.1
PHP 5.4.4
drupal-8.0.0-beta1.tar.gz
I fill the following steps:
1. Select an installation profile
2. Database configuration
and then i get this Error in my browser:
"The connection was reset
The connection to the server was reset while the page was loading.
php_error.LOG
[03-Oct-2014 11:19:38 UTC] PHP Fatal error: Call to a member function get() on a non-object in /Users/myself/Documents/drupal.sites/drupal8/core/lib/Drupal.php on line 566
[03-Oct-2014 11:19:38 UTC] PHP Stack trace:
[03-Oct-2014 11:19:38 UTC] PHP 1. _drupal_exception_handler() /Users/myself/Documents/drupal.sites/drupal8/core/includes/bootstrap.inc:0
[03-Oct-2014 11:19:38 UTC] PHP 2. _drupal_log_error() /Users/myself/Documents/drupal.sites/drupal8/core/includes/bootstrap.inc:1080
[03-Oct-2014 11:19:38 UTC] PHP 3. Drupal::theme() /Users/myself/Documents/drupal.sites/drupal8/core/includes/errors.inc:128
Comment #16
jelo CreditAttribution: jelo commentedRunning XAMPP on Windows results in the same error. D8 B1 does not install at all...
Comment #17
BarisW CreditAttribution: BarisW commentedSame here as #15, with D8 beta2.
Comment #18
BarisW CreditAttribution: BarisW commentedComment #19
BerdirSee my notes in #2322269: Undefined method addDependencyTrait() Breaks VPS Install
As written there, this happens when an error happens very early. In this case it is an exception. You need to figure out what exception exactly by adding debug statements to _drupal_exception_handler(), like var_dump($e->getMessage()) and var_dump($e->getTraceAsString().
Comment #20
dcrocks CreditAttribution: dcrocks commentedI have been seeing this error
[Mon Nov 03 20:02:21.491327 2014] [:error] [pid 4671] [client ::1:50210] PHP Fatal error: Call to a member function get() on a non-object in /Users/rocks/Sites/drupal8/core/lib/Drupal.php on line 566
for a very long time in D8, maybe a year or more. It happens very early in install, before the 1st install page is displayed, only shows up once, only in the apache error log, and seems to have no affect on the install. The last is why I have mostly ignored it. But since D8 is now in beta it is probably more important to clean this up. I tried your debug statements in #19 but this error doesn't seem to be going thru that code. If you can suggest someplace else to try to debug, I'll give it a try.
Comment #21
MrHaroldA CreditAttribution: MrHaroldA commentedI just got this error on a fresh Drupal-8.0.0-beta3 install.
I'll try to debug this, but the reason I installed D8 is that I don't understand anything in D8 ;)
Comment #22
askibinski CreditAttribution: askibinski commentedI got this when I pushed some site code (theme, custom modules) from dev to test, and imported my database from dev to test (beta 2).
I tried truncating all cache_ tables and clearing php files in files dir, but that didn't help.
update: Figured out my problem was caused by an empty salt string in $settings['hash_salt'] on my remote environment. (The salt is only generated on install). See also this drush issue on github.
Comment #23
13rac1 CreditAttribution: 13rac1 commentedMarked #2377631: Early Install error: PHP Fatal error: Call to a member function get() on a non-object as a duplicate of this
Comment #24
dcrocks CreditAttribution: dcrocks commentedre: #23. Even though the issue summary hasn't changed, multiple problems with similar symptoms are being discussed here. That is why I created #2377631: Early Install error: PHP Fatal error: Call to a member function get() on a non-object and don't wish to close it.
Comment #25
13rac1 CreditAttribution: 13rac1 commentedSeems like the other problems described in this issue have been dealt with. Can we close this issue?
Comment #26
dcrocks CreditAttribution: dcrocks commentedSeems like https://github.com/drush-ops/drush/issues/1002 has solved the drush issues.
Comment #27
moshe weitzman CreditAttribution: moshe weitzman commentedYeah, lets close this. Interested folks can follow #2377631: Early Install error: PHP Fatal error: Call to a member function get() on a non-object
Comment #28
znerol CreditAttribution: znerol commentedThis has been fixed in #2317913: Early error handling can result in fatal error (Call to a member function get() on a non-object). Given the obscurity of this problem, I expect that there are still a couple of duplicates in the queue.