This error may have many causes:
Note: Don't change your site's settings.php
or files within your site's sites/default/files/config_HASH/active
directory.
1. Possible Simple Solutions
- You accessed a Drupal site root eg: www.yoursite.com/ before installation was complete. Go to www.yoursite.com/core/install.php. (Seen in Drupal 8, Beta 7 and Beta 10)
2. Your site's Dependency Injection Container (DIC) needs to be rebuilt.
First, try to run update.php
(example.com/update.php) in your browser (this is not a PHP file but a route to DbUpdateController).
If you still get this error try to remove the php
directory in sites/default/files
.
3. Your site's database caches may have been left in an unstable state or may be stale.
Clearing the {cache_*}
tables may solve this issue. The best method for clearing caches if you are new to Drupal is to log in as an administrator and visit yoursite.com/admin/config/development/performance
then click the button labeled Clear all caches.
With drush
If you can't access the admin tools to clear Drupal's cache the traditional way, try with drush, a command line tool for Drupal and execute this command in the terminal:
drush cache-rebuild
or one of it's aliases:
drush cr
OR drush rebuild
For further details here.
4. Your site's database is not running or is not configured properly.
Verify that your database is running. If your database (Ex. MySQL) is not running, turn it on and then go back to your site's homepage.
5. Drupal is not installed properly.
This error occurs when your settings.php
file is already populated but your database is empty. This usually occurs when you're trying to re-install, and can be caused by Drupal not having write permissions on settings.php
.
There are two possible solutions to resolving this issue:
- Copying
default.settings.php
oversettings.php
. - Allowing write permissions for the server user on
settings.php
6. Your site's modules or libraries do not adhere to standard PHP coding practices.
This may be especially true if your module or library is missing required use
statements, i.e., if your code files are missing necessary imports. Check whether you have included use
statements for all of the PHP classes and interfaces in your code.
7. Opcode cache configuration
OPcache for example requires the following settings to work with Annotations:
php_admin_flag[opcache.load_comments] = on
php_admin_flag[opcache.save_comments] = on
8. Coding errors in a module (often a custom module)
This error can be triggered by a coding error, specifically if you have created a new module in the modules directory, activated it, and did something wrong. If you have the dblog module enabled, you may find a relevant error through looking at the most recent records in the watchdog table. Since this error prevents use of the Drupal front end, you'll need to use a database tool like phpMyAdmin or a command line utility. Sample query:
SELECT message, variables FROM watchdog WHERE type = 'php' ORDER BY timestamp DESC LIMIT 1;
Sample result:
| %type: !message in %function (line %line of %file). | a:5:{s:5:"%type";s:24:"BadFunctionCallException";s:8:"!message";s:120:"Theme hook "my_example" refers to a theme function callback that does not exist: "theme_mmy_example"" ... |
In this case, the error is a typo in the function name given in a hook_theme()
implementation.
A message in the watchdog table like Recursive router rebuild detected.
indicates an error in a x.routing.yml
file. Remove (or rename) your routing.yml
and reload your root page - the error is gone.
Also note:
A YAML file cannot contain tabs as indentation
If you have tabs in your routing.yml
you'll get that error also.
9. Check for mistakes in theme yml files
You might have forgotten something as simple as a colon.
For example, in YOURTHEME.libraries.yml
, when listing css, don't forget the colon behind the .css extension, like so:
css/main.css: {}
10. You forgot hash_salt in settings.php
Drupal requires a settings key called hash_salt
to secure transient hashes.
It will be generated during Drupal install and added to settings.php
. If you use a different settings.php in different environments (for example, a settings.local.php
), you may have forgotten to set this variable.
Add a line to your local settings.php like:
$settings['hash_salt'] = 'whatever you like';
11. You have overwritten settings.php with example version
Since git per default excludes the settings.php per default in the repository you may accidentally replace the version on server with environment version (eg. renaming example.settings.php
in IDE such as PhpStorm). And therefore wiping out database settings and $settings['hash_salt'] = ' '
hash-string leaving your site in a non-functioning state.
Error in Drush
When using drush rebuild or drush rebuild-cache after correcting database settings you might get "exception 'RuntimeException' with message 'Missing $settings['hash_salt'] in settings.php.'"
.
Find hash_salt string
Check for a folder starting with config_ in sites/default/files. Voilá, there is the hash_salt string. Just add this inside the quotes of $settings['hash_salt'] = ' '
(without the prefix config_) and save.
PHP error on configurations pages
If you get the error visiting the admin configuration pages:
The website encountered an unexpected error. Please try again later.
And the following from your error.log file:
Uncaught PHP Exception Exception: "The configuration directory type 'sync' does not exist"
Simply add an sync
folder in an appropriate place on your filesystem, and add a line to your settings.php like:
$config_directories['sync'] = __DIR__ . '/sync';
The above snippet is for use on a local development machine (for example, in settings.local.php).
You should only have to do this when moving a site from one host to another. Drupal will create appropriate directories during installation in your sites/default
or sites/<sitename>
folder.
Missing trusted host pattern
You'll probably get an error in Status Report saying your site is vulnerable.
You can find the example in settings.php or on this page.
$settings['trusted_host_patterns'] = array(
'^www\.example\.com$',
);
Tadaaa, it hopefully works. Better than re-installing and losing everything!
-----
@TODO - more reasons here
Comments
I experienced this when
I experienced this when accidentally MySQL Server is not running
I saw this error using Drupal8 site when the
I saw this error when the database user's password was wrong and when the user's permissions were not set correctly on the database.
----------------------------------------------------------
- R Karajgikar
I ran into this problem with
I ran into this problem with a MySQL failure today. MySQL "silently" failed but I detected it on a reboot when I could see it failed to start at Boot. It was a matter of my Ubuntu server running out of available disk space. Clearing the cached package files via "sudo apt-get clean", allowed me to start the mysql server and my Drupal 8 Alpha 15 came back up.
I have run into this when
I have run into this when editing or creating various yml files.
Have to reinstall entire Drupal site if none of the above works.
Not fun.
Needs to be reported as a bug, if it has not already.
If UX / DX is really a priority, there needs to be a more user-friendly restoration / debug / diagnostic process instituted.
Yup, same problem and
Yup, same problem and reinstalled the complete Drupal installation. Worked good then.
Vaibhav Jain
Watch out for servers running PHP 5.2.x or 5.3.x
A few other things to check:
drush site-install
, you may need to change permissions of the auto-generated settings.php file to 744 instead of 444 to let Drupal finish doing whatever it needs to. See this comment for more info.__________________
Personal site: www.jeffgeerling.com
Presence of settings.php causes this
I found that if I created the settings.php file, as you do when you create a drupal website, then I get this error. After flailing round the web looking for an answer it occurred to me to delete my settings.php and after that drupal installed. The install script should really be more intelligent regarding readiness for install.
One of the things that caused
One of the things that caused this for me was an exception "Missing $settings['hash_salt'] in settings.php." - which I guess was due to me upgrading a dev copy of d8 to the latest git without totally rebuilding. Core is still unstable.
I did try to start fixing it by hand but ran into more issues, so just nuked the database and started again.
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Fixed by deleting the config folder
After install of Drupal beta and activating all of the Webservices modules this error was shown.
I fix this error by deleting the config folder in "sites/default/files/config_*/". I found out that there were two config folders in this directory. The newest was empty, probably created by Drupal. When deleting the newest folder the problem was solved
Happened after drush 7.x cache-rebuild
Did a drush cache-rebuild on a working site and got the blank screen except for "If you have just changed code (for example deployed a new module or moved an existing one) read http://drupal.org/documentation/rebuild" error. Following the instructions above including truncation got the following error during reinstallation:
Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue, got ')' at position 614 in class Drupal\menu_link\Entity\MenuLink. in Doctrine\Common\Annotations\AnnotationException::syntaxError() (line 41 of /Users/stuart/Sites/drupal-8.x-dev/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php).
Total reinstallation required.
I saw this error after
I saw this error after changing the theme (Helios responsive html5 8.0-dev).
After switching back to Bartik 8.0-alpha13 the error was gone.
(Server running under php 5.5)
Helios responsive theme was
Helios responsive theme was/is broken, some twig variables have not been updated along with latest core changes.
--
Perttu Ehn
Omega theme
The same happens with latest Omega 8.x-dev.
The same happened with the
The same happened with the Bootstrap 3 base theme. However, the bootstrap_business theme does currently (partially) work with Drupal 8.
RouteNotFoundException after uninstalling a module
If you uninstall a module in D8 and get a
RouteNotFoundException
, there's a known bug documented at https://www.drupal.org/node/2266325 "RouteNotFoundException when a module (previously added to shortcuts) disabled".This has happened to me even though I never explicitly added a shortcut.
Also see my blog posting about this particular issue at http://optimizely-to-drupal-8.blogspot.com/2014/06/issue-uninstalling-mo...
Clearing cache
How to clear all cache (see point 2 in the instructions)?
instruction for clearing caches
Thanks for pointing out the need, @AndrezejG. See the update to the docs.
ownsourcing.com - Drupal training
Drush
Do you have Drush installed?
cd ~/path/to/mysite
drush cr (drush cache-rebuild will also work).
Got this when upgrading D8 beta1 to beta2
I just unzipped beta2 in my running installation (cause it's an alpha with restricted access). Afterwards, my site was not showing up any more. update.php was not working and deleting sites/default/php was also useless.
Had to restore files and database from my nightly backups, now I stay on beta1 for a while.
Cheers
Rainer
same problem
just did a complete install on top of a working (unmodified) beta1. There is no update.php module any more so the documentation needs fixing. I do see a rebuild.php but it doesn't help.
Walt Daniels
found update.php but ...
got
Fatal error: Call to a member function getPath() on a non-object in /home/nynjtcs/public_html/d8test.xxxxxx.org/core/lib/Drupal/Core/Theme/ThemeInitialization.php on line 163
running it.
Walt Daniels
Needs enable classy
I ran in to same problem, but found out that classy needs to be enabled. After that all works.
See https://www.drupal.org/node/2329501#comment-9256129
Experienced on clean install
I tried installing 8.0.0-beta3 on a local WAMP server.
First received the following:
Then after trying to go to a different path like
upgrade.php
I received the error mentioned here.Followed the steps and only succeeded when I replaced the
settings.php
.Tried installing again and got the following:
In both cases watchdog did not provide any information.
A database tables drop and replacing all files resulted in a successful installation.
Please Note: I did go to great lengths to try and find the reason why it failed, I just thought I should mention what I experienced.
Another cause that I have
Another cause that I have seen is selinux. Scenario: If a server is rebooted or selinux enfocement mode is changed to "enforcing" and contexts aren't properly configured you may also get this message. In production I would recommend correcting the context. In a development environment, you can get away with disabling selinux...not recommended (ever).
If you have just changed code
I updated my Drupal-8 instance to latest beta and now I'm getting following message:
I tried to follow some of these steps, but hitting road block(
or maybe I'm doing something entirely wrong... after installing "drupal-8.0.0-beta6" I then copy my drupal/sites from -beta3 to -beta6 and start getting that message...
please advise.
Don't work update drupal8beta4 to drupal8beta6
After finished the documentation, i see the same error.
I clear cache with drush cr, but i have this error 'The container_yamls setting is missing from settings.php '
i not understand, someone help me.
Your solution
https://www.drupal.org/documentation/rebuild#comment-9678619
There have been changes to
There have been changes to default.settings.php in betra 6.
Look at your settings.php and the new default.settings.php and copy the missing pices.
My problem case
In my case it was missing:
$settings['container_yamls'][] = __DIR__ . '/services.yml';
How about we put simple reasons first?
This page is marked as 'Beginner Level', but the first bullet point is:
"1. Your site's Dependency Injection Container (DIC) needs to be rebuilt"
While helpful to some, I think that would scare/confuse most beginners, so could we filter out simpler issues before getting too technical?
I have started a 'Possible Simple Solutions' un-ordered list, with the issue that brought me to this page:
While cloning several sites in Acquia Dev Desktop, I accidentally access a Drupal 8, Beta 7 site root before running /core/install.php.
Solved my prob after def. CONFIG_SYNC_DIRECTORY const in setting
When I moved my site from pantheon, which I set up on pantheon initially, I ran into problems after exchanging the settings files from pantheon with them from drupal.org (8.0.2) - in my case.
I got the following error:
Exception: The configuration directory type 'sync' does not exist in config_get_config_directory() (line 154 of core/includes/bootstrap.inc).
So I added
to my settings.local.php which made my site run again.