Proposed resolution
Turns out having PHP variable 'OPEN_BASEDIR' set causes glob() to return FALSE instead of an empty array when it finds no files on its scan. Found this comment in PHP reference manual for glob():
"If you have open_basedir set in php.ini to limit which files php can execute, glob(...) will return false when there are no matching files. If open_basedir is not set, the very same code will return an empty array in the same situation."
See comments in #1. It proposes a solution if someone wants to follow up. If you don't need 'OPEN_BASEDIR', the solution is easy.
Original report by SIFRO
Hello,
i'm trying a fresh install of D8 to see if i can help, but i can't even go past the installation process.
After unpacking, at step 1/7 and 2/7 i get the following warnings:
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).
Then, after entering mysql details and clicking on "proceed" (http://www.example.com/core/install.php?langcode=en&profile=standard&op=...), the fun ends with a fatal error :(
Fatal error: Call to undefined function theme() in /path/to/core/includes/install.core.inc on line 941
Comments
Comment #1
dags commentedThe warning occurs because the method getComponentNames() attempts to iterate over the $files variable - but in some cases, that variables value is FALSE.
From InstallStorage.php lines 131-145. HEAD at b416a37.
According to the PHP docs, glob() is supposed to return an empty array if it doesn't find a matching file and should only return FALSE on error. I can't see why it's returning FALSE in this case but it does so when searching in the following directories, all of which contain no *.yml files:
To circumvent the warnings for now, change
$files = glob($directory . '/*' . $extension);to
$files = glob($directory . '/*' . $extension) ?: array();However, after doing that I ran into this seemingly unrelated error:
Fatal error: Call to undefined function theme() in /var/www/d8/core/includes/install.core.inc on line 947Investigating that now...
Comment #2
dags commentedTurns out that undefined function theme() error message is a little misleading...
In install.core.inc, install_display_output($e->getMessage, $install_state) is called if an exception occurs while executing install_being_request($install_state) or install_run_tasks($install_state). The root error message is "The service definition "module_handler" does not exist."
Comment #3
larowlanDo you have core.services.yml? There should be yml files in those folders above too.
Comment #4
dcrocks commentedI can't reproduce this, but those directories don't have any files in their config directory in a finished install, so it would seem best to focus on why glob() is returning false. It might help to know what environment this is occurring in. A note from the PHP manual about glob():
"If you have open_basedir set in php.ini to limit which files php can execute, glob(...) will return false when there are no matching files. If open_basedir is not set, the very same code will return an empty array in the same situation."
Comment #5
Sifro commentedUPDATE: after receiving the warning and the fatal error explained above, now if i try to go the homepage i get this:
Fatal error: Call to a member function get() on a non-object in /path/to/core/lib/Drupal.php on line 147
Of course i didn't expect it to work considering that the installation failed, but it might be an hint for someone.
I have really no idea of how to proceed.
Comment #6
Sifro commentedRegardin my env... these are the compile options:
'./configure' '--with-apxs2' '--with-curl=/usr/local/lib' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex=/usr/local' '--with-pdo-mysql=/usr' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-xsl' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'
Loaded modules: core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_reqtimeout mod_include mod_filter mod_deflate mod_log_config mod_logio mod_env mod_expires mod_headers mod_unique_id mod_setenvif mod_version mod_proxy mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_ajp mod_proxy_balancer mod_ssl prefork http_core mod_mime mod_dav mod_status mod_autoindex mod_asis mod_suexec mod_cgi mod_dav_fs mod_dav_lock mod_negotiation mod_dir mod_actions mod_userdir mod_alias mod_rewrite mod_so mod_cloudflare mod_php5
Open basedir: /home/myuser/:/tmp:/var/tmp:/usr/local/lib/php/
Safe Mode: OFF
Magic Quotes: OFF
Don't know if there are any other settings worth checking.
UPDATE: now i'm trying to download from the git repos instead of the alpha2 version on the website, and at the "verify requirements" step i get this:
Requirements problem
The service definition "request" does not exist.
It seems quite a common problem already addressed in the forums.
UPDATE 2: i managed to workaround the problem above, and ended up getting the same error at the same step
Fatal error: Call to undefined function theme() in /path/to/drupal/core/includes/install.core.inc on line 947
Comment #7
dags commented@dcrocks - spot on! I had forgot that I set the 'open_basedir' property when I was trying to get PHPStorm working with XDebug on my dev VM. I removed it and now those warnings disappear. I'm still having trouble installing against the most recent HEAD though... but at least 1 mystery is solved. Thanks!
Comment #8
dags commented@Sifron,
The error:
The service definition "request" does not exist.is most often caused because settings.php does not have write permissions. Make sure you check that. I was getting the undefined function theme() error too. I was able to work around it by adding require_once theme.inc somewhere in the bootstrap phase but I forget exactly where now (sorry, I know that doesn't help, I'll try to remember and update this post). Anyway, resolving that error didn't really help much as I eventually ended up with undefined function call get() on a non-object that you were getting too.Comment #9
dcrocks commentedI don't know how often open_basedir is used or if it is documented as unsupported by drupal so a fix for that might still be in the cards. I've seen a number of errors in D8 install where the original error is deeply hidden(see #1987262: [Installation Error] Symfony: "The service definition 'request' does not exist."). Some of them trace back to permissions problems, others to database problems. Can you give more info on your install: OS, database, php version, etc.?
Comment #10
dags commentedServer
Ubuntu 12.04.1 server running in a VirtualBox VM using Vagrant.Apache
PHP
I haven't been making any drastic changes but I have been tinkering with Xdebug trying to get remote debugging working with PHPStorm which is running and is what is helping me debug these installation errors.
Database
I'm connecting to the Drupal 8 database through the root user. Here's the result of mysql status:
The errors I'm experiencing happen against the current HEAD of 8.x when performing a clean installation. These are the steps I follow, from the root dir:
I'm tailing the PHP log with
tail -f /var/log/php/error.logand I see this when visiting http://d8.local/. It's interesting because it says it's a fatal error yet installation continues uninterrupted. I don't see this error if I go directly to http://d8/core/install.php/.Then I continue on with the installation process and get through entering in the Database information and that's where things go down... On my most recent attempt, I'm getting this error, which I've never seen before:
UPDATE:
After seeing the above error message, I refreshed the page and installation continued. I moved on to another task but when I came back I saw the admin setup screen with this error message at the top:
I filled out the fields, clicked continue, and was given message that Drupal was already installed. I clicked view site and got a 324 (net::ERR_EMPTY_RESPONSE). This was in /var/log/php/error.log:
Comment #11
Sifro commentedSo, to summarize...
Steps to reproduce:
- unpack d8 (either from .tar.gz or git pull)
- immediatly get this warning:
Warning: Invalid argument supplied for foreach() in Drupal\Core\Config\InstallStorage->getComponentNames() (line 138 of core/lib/Drupal/Core/Config/InstallStorage.php).- if i don't set proper permissions, i also get the error outlined here: #1987262: [Installation Error] Symfony: "The service definition 'request' does not exist."
- enter my mysql details, click on "proceed", and get a fatal error:
Fatal error: Call to undefined function theme() in /path/to/core/includes/install.core.inc on line 941- go to the homepage and get another fatal:
Fatal error: Call to a member function get() on a non-object in /path/to/core/lib/Drupal.php on line 147@dags: At a certain point, while trying to investigate the issue, i got the "service definition "feed.bridge.reader" does not exist" error too, but sorry, i don't remember the exact steps i took.
Comment #12
dcrocks commentedWe know why you get the error in getComponentName. Could you either reset 'open_basedir' in your PHP settings or make the change suggested in #1 so that doesn't confuse the issue? It may be contributing to later errors.
Comment #13
Sifro commentedIndeed setting open_basedir off solves all the problems for me after a fresh install.
Comment #14
dcrocks commentedThat's great. Solving problems during install can be very painful in my experience.
Comment #15
Sifro commentedi'm marking this issue as solved, even if probably the fact that drupal doesn't work with open_basedir ON is not a good thing i guess.
Comment #15.0
dcrocks commentedhiding personal data
Comment #16
dcrocks commentedChanged the title to better reflect the situation. Maybe someone will notice. Also updated issue summary.
Comment #17
Sifro commentedok, in this case it should be also in Active status.
Comment #18
longwaveThere is already an issue for deciding what to do about open_basedir at #2019911: Add install requirement that open_basedir = Off since 8.x currently doesn't support it
Comment #19
dcrocks commentedClosing this then as a duplicate of #2019911: Add install requirement that open_basedir = Off since 8.x currently doesn't support it.
Comment #19.0
dcrocks commentedUpdating summary