2

I'm trying to get Drupal to work inside an Alpine Linux docker container but for some reason drush can't be used to manage the website. The website itselfactually works fine, drush just can't bootstrap.

Here's the pertinent information:

 /var/www/html # drush core-status
 Drupal version         :  7.56                        
 Site URI               :  http://default              
 Database driver        :  mysql                       
 Database hostname      :  vlp-dcimysql01.dhe.duke.edu 
 Database port          :                              
 Database username      :  tmp_drupal                  
 Database name          :  tmp_drupal                  
 PHP configuration      :  /etc/php7/php.ini           
 PHP OS                 :  Linux                       
 Drush script           :  /usr/bin/drush              
 Drush version          :  8.1.14                      
 Drush temp directory   :  /tmp                        
 Drush configuration    :                              
 Drush alias files      :                              
 Drupal root            :  /var/www/html               
 Drupal Settings File   :  sites/default/settings.php  
 Site path              :  sites/default               

/var/www/html # drush wd-show
PHP Fatal error:  Uncaught Error: Call to undefined function cache_get() in /var/www/html/includes/module.inc:754
Stack trace:
#0 /var/www/html/includes/module.inc(954): module_implements('system_theme_in...')
#1 /var/www/html/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /var/www/html/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /var/www/html/includes/theme.maintenance.inc(57): list_themes()
#4 /var/www/html/includes/bootstrap.inc(2872): _drupal_maintenance_theme()
#5 /var/www/html/includes/errors.inc(179): drupal_maintenance_theme()
#6 /var/www/html/includes/bootstrap.inc(2609): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
  thrown in /var/www/html/includes/module.inc on line 754
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                                     [error]
Error: Uncaught Error: Call to undefined function cache_get() in /var/www/html/includes/module.inc:754
Stack trace:
#0 /var/www/html/includes/module.inc(954): module_implements('system_theme_in...')
#1 /var/www/html/modules/system/system.module(2511): module_invoke_all('system_theme_in...')
#2 /var/www/html/includes/theme.inc(798): _system_rebuild_theme_data()
#3 /var/www/html/includes/theme.maintenance.inc(57): list_themes()
#4 /var/www/html/includes/bootstrap.inc(2872): _drupal_maintenance_theme()
#5 /var/www/html/includes/errors.inc(179): drupal_maintenance_theme()
#6 /var/www/html/includes/bootstrap.inc(2609): _drupal_log_error(Array, true)
#7 [internal function]: _drupal_exception_handler(Object(Error))
#8 {main}
  thrown in /var/www/html/includes/module.inc, line 754

As stated before, the platform is Alpine Linux, PHP is 7.1.9

I can add more if anything is unclear. I've checked the PHP logs but they just produce the above output. I'm open to there just being a module/extension missing, but I'm not entirely sure how to figure that out if it doesn't ever tell me "undefined function extensionFunctionX" or something like that. The above undefined function appears to be a Drupal core function.

Note that the website works, so it's communicating with the database without issue, I can also do a SHOW TABLES in MySQL and see the Drupal installer's tables were created.

  • @kenorb Tried drush cc all and it just cleared the drush cache out. We're planning on using redis eventually, but haven't progressed that far into the install yet. – Bratchley Nov 30 '17 at 22:45
  • Does drush sql-connect returns the right credentials? If so, can you run: $(drush sql-connect) in shell? – kenorb Nov 30 '17 at 22:52
  • 1
    I'm now thinking the issue is with my understanding of drush. The "fix" seems to be installing the mysql client program. See here where it immediately started working once I added those packages. Is there a less install-heavy way of fixing this problem? Why would installing the client program matter? Shouldn't drush use the PDO MySQL extensions? – Bratchley Dec 1 '17 at 1:45
  • Installing db client matter, because drush is using the command when connecting to the database. However I'm not sure why it's needed for wd-show command. You can suggest some improvements at GitHub. – kenorb Dec 1 '17 at 11:01
1

In my case (moving production website to fresh server) memcached was enabled in settings.php, PHP daemon was installed and running on server, but no PHP extension was installed

0

The error happens because your Drupal is not correctly bootstrapped. Normally, you should see the following lines when running drush status:

Database                        :  Connected                                                      
Drupal bootstrap                :  Successful                                                     

So you should double check your database credentials in your settings file whether they're pointing to the right database and host (it's accessible from your command-line), your MySQL client command is installed and present (for example, with apk add mariadb-client) and your MySQL server is up-and-running.

You can check your database connection via drush sql-connect command. If that's correct, try to connect to the database by running $(drush sql-connect) in your shell.

In case of problems, try to clear Drush caches by using drush cc drush first.

If your website works fine, double check how you load your database credentials. Sometimes, people are using if or switch/case statements for different environments based on the host and forgot about the command-line interface which is not included.

  • Yeah like I was saying, the website works, so it's communicating with the database without issue, I can also do a SHOW TABLES; in MySQL and see the drupal installer's tables were created. – Bratchley Nov 30 '17 at 22:44
  • Website and command-line can work differently, they can use different PHP configuration. You need to make sure drush has access to the right database credentials. Please double check the answer whether you missed anything. Make sure mysql command is available in your shell. When you checked something, please re-edit your question to clarify what you've done so far. E.g. what's the output of: $(drush sql-connect) shell command. – kenorb Nov 30 '17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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