Skip to main content

Troubleshoot Drush

Review solutions to common Drush troubleshooting scenarios.

This section provides solutions to common Drush troubleshooting scenarios.

Reading the Pantheon Environment from Drush

Drush does not run using the web server. This makes reliance on the $_SERVER superglobal problematic as some of the contents of that array will be missing, for example ['PANTHEON_ENVIRONMENT']. Drush commands and policy files must reference $_ENV when reading Pantheon environment information. Refer to our documentation on using the $_SERVER superglobal in custom code for more information.

Terminus Drush Silent Failure

The following silent failure occurs when executing terminus drush commands on environments that use redirect logic without checking to see if Drupal is running via the command line:

[notice] Command: <site>.<env> -- 'drush <command>' [Exit: 1]

Newer versions of Drush fail with the message: [warning] Drush command terminated abnormally. For example:

[warning] Drush command terminated abnormally.
[notice] Command: <site>.<env> -- 'drush <command>' [Exit: 1]

Redirects terminate the PHP process before the Drush execution is complete. You can resolve this error by adding php_sapi_name() != "cli" as a conditional statement to all redirect logic within settings.php:

// Require HTTPS, www.
  ($_ENV['PANTHEON_ENVIRONMENT'] === 'live') &&
  // Check if Drupal or WordPress is running via command line
  (php_sapi_name() != "cli")) {
  if ($_SERVER['HTTP_HOST'] != '' ||
      !isset($_SERVER['HTTP_USER_AGENT_HTTPS']) ||
    header('HTTP/1.0 301 Moved Permanently');
    header('Location:'. $_SERVER['REQUEST_URI']);

Drush Commands on Remote Aliases Not Working from Inside Local Drupal Install

Some Drush 5 commands must be executed from outside the context of a local Drupal installation, due to a known issue with Drush 5. The output from a Drush 5 command run in this context looks like the following:

drush @pantheon.SITENAME.ENV status
 PHP configuration : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/
 Drush version : 5.10.1
 Drush : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/drushrc.
 configuration php

Change your directory to a context outside of a working local Drupal installation to make your Drush 5 commands work on Pantheon aliases:

cd ..
drush @pantheon.SITENAME.ENV status
 Drupal version : 7.26
 Site URI :
 Database driver : mysql
 Database hostname :
 Database username : pantheon
 Database name : pantheon
 Database : Connected
 Drupal bootstrap : Successful
 Drupal user : Anonymous
 Default theme : bartik
 Administration theme : seven
 PHP configuration : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/php5
 Drush version : 5.10.1
 Drush configuration : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/drus
 Drupal root : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/code
 Site path : sites/default
 File directory path : sites/default/files
 Private file : sites/default/files/private
 directory path
 Temporary file : /srv/bindings/754cbef0a7b54a07ab07167ef8de7377/tmp
 directory path

Drush Error: "Unknown option: --db-url"

This error only affects Drupal 7 sites running a Drush version below Drush 8, and looks similar to the example below:

drush @pantheon.SITENAME.ENV cc all
Unknown option: --db-url. See `drush help cache-clear` for available [error]
options. To suppress this error, add the option --strict=0.

Follow the suggestion and add the option --strict=0 to resolve this error:

drush @pantheon.SITENAME.ENV cc all --strict=0
'all' cache was cleared in [success]

Drush Error: "No Drupal site found", "Could not find a Drupal settings.php file", or missing system information from status

This error looks similar to the example below.

Could not find a Drupal settings.php file at ./sites/default/settings.php

You can add a default or empty sites/default/settings.php to your site's code to resolve this error.

Unable to Connect to MySQL Server

You might encounter the following error when running Drush MySQL commands:

ERROR 2003 (HY000): Can't connect to MySQL server on '' (61)

This error response happens when an inactive site has spun down. Wake environments by loading the home page or with the following Terminus command to resolve this error:

terminus env:wake SITENAME.ENV

Unable to Connect to Hostnames (DNS)

Some ISPs have issues resolving a hostname;. You can use the dig command to investigate if you're experiencing trouble connecting to a hostname.

;; Truncated, retrying in TCP mode.

; <<>> DiG 9.8.1-P1 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 38905
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

; IN A

;; Query time: 11 msec
;; WHEN: Thu Aug 30 12:28:25 2012
;; MSG SIZE rcvd: 78

In the example above, the REFUSED status suggests an incorrect resolution. The next step is to run dig with a specified DNS server. We recommend using Google's DNS (

dig @
;; Truncated, retrying in TCP mode.

; <<>> DiG 9.8.1-P1 <<>> @
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36494
;; flags: qr rd ra; QUERY: 1, ANSWER: 34, AUTHORITY: 0, ADDITIONAL: 0

; IN A

... 599 IN A

;; Query time: 52 msec
;; WHEN: Thu Aug 30 13:02:00 2012
;; MSG SIZE rcvd: 622

In this example, Google's DNS is able to correctly resolve the hostname.

You can adjust your local settings to use Google's DNS ( and instead of the default provided by your ISP to correctly resolve the host names.

Timeouts When Using Long-Running Migrate or Other Drush Commands

Long-running Drush commands that produce no output will cause the SSH gateway to timeout. Pantheon's timeouts for SSH based commands are outlined in our documentation on timeouts. Confirm that your commands return output to the terminal session in under 10 minutes to avoid a timeout related to a lack of output.

For example, using the --feedback flag:

drush migrate-import migration --feedback="1000 lines processed"

Drush error: Failed opening required .../vendor/bin/includes/

This error indicates that the vendor directory contains Drush binaries that should be removed. Remove any Drush files from vendor/bin and vendor/drush using git rm.

Fatal error: require(): Failed opening required '/srv/bindings/.../code/vendor/bin/includes/' (include_path='.:/usr/share/pear:/usr/share/php') in /srv/bindings/.../vendor/bin/drush.php on line 11

Drush 11 error: Declaration of Drush\Sql\Sqlmysql::command() must be compatible with Drush\Sql\SqlBase::command()

This error can occur on Multidevs with a site-local installation version of Drush 11 that removes the Drush version from the pantheon.yml file. This error occurs because the Multidev does not recognize that there is a site-local installation and attempts to use the Pantheon-installed version (which by default is Drush 8.4.12).

You can add a compatible Drush version in your pantheon.yml file to refresh the environment as a potential workaround. For Drupal 9 and later, add drush_version: 10 to the pantheon.yml file.

More Resources