Unable to recognize mysqlnd host I have installed mysqlnd when I try to use the drush command drush cc all, I get the following message.


  No Drupal site found, only 'drush' cache was cleared.


and when I run the command drush ws I get the following message. 


  PHP Fatal error:  Call to undefined function module_exists() in phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc on line 187
  Drush command terminated abnormally due to an unrecoverable error.
  [error]
  Error: Call to undefined function module_exists() in
  phar:///usr/local/bin/drush/commands/core/drupal/environment_7.inc, line 187


If I try to run the above commands without the mysqlnd plugin, they work fine.

Also, if I run drush status I get the following:

 Drupal version         :  7.43                             
 Site URI               :  http://default                   
 Database driver        :  mysql                            
 Database hostname      :  myapp                            
 Database port          :                                   
 Database username      :  drupal                           
 Database name          :  web1                             
 PHP configuration      :  /etc/php.ini                     
 PHP OS                 :  Linux                            
 Drush script           :  /usr/local/bin/drush             
 Drush version          :  8.1.3                            
 Drush temp directory   :  /tmp                             
 Drush configuration    :                                   
 Drush alias files      :  /root/.drush/aliases.drushrc.php 
 Drupal root            :  /var/www/html/site2              
 Drupal Settings File   :  sites/default/settings.php       
 Site path              :  sites/default 


The above won't show the theme name. Also if I try to run drush mysql-cli I get the following message:


  ERROR 2005 (HY000): Unknown MySQL server host 'myapp' (0)


I wonder if I can get the above commands running using the mysqlnd plugin.
The solution was adding the following code in settings.php. It will allow Drush to connect to mysqlnd.

if (drupal_is_cli() || basename($_SERVER['PHP_SELF']) == 'update.php') {
  $databases['default']['default'] = $databases['default']['ms'];
}