Cloud Platform

About Drush on Cloud Platform

Note

This page is for applications running the current Drupal version. For information about Drush and Drupal 7, see Drush and Drupal 7 on Cloud Platform.

Drush is a command-line shell for Drupal, which you must require as part of your Composer-built Drupal website. With Drush, you can perform administrative and application maintenance tasks from the command line instead of Drupal’s administrative interface.

The current Drupal version requires Drush version 11 or later. Newer versions of Drush, that is, version 11 and later, must be installed via Composer. Acquia does not manage the update to the newer versions. For more information, see About Drush on Cloud Platform.

Using Drush on Cloud Platform

Drush maintainers recommend to not rely on Drush as a global command. The reason for this recommendation is that the versions required to support each new version of Drupal change frequently, and it is imperative to use the version of Drush that your version of Drupal supports.

Although multiple versions of Drush (currently, Drush 6 to Drush 10) are available as global commands on Cloud Platform, Acquia recommends that you include Drush within your project via Composer. For the current Drupal version and Drush version 11 and later, you must include Drush as a Composer dependency if you want to use it, because Drush 10 is not compatible with the current Drupal version.

Note

The Drush alias files that Cloud Platform generates are not compatible with Drush 12. For more information, see An error message is displayed while running Drush 12 commands.

Installing Drush in your project

Note

To use Remote Administration with Drush, you must include Drush within your project.

~/example_repo$ composer require drush/drush
~/example_repo$ ls -lha
drwxr-xr-x@ 11 user  staff   352B 28 Jan 11:04 .
drwxr-xr-x@ 31 user  staff   992B 17 Mar 12:23 ..
-rw-r--r--@  1 user  staff   3.2K 28 Jan 12:02 composer.json
-rw-r--r--@  1 user  staff   250K 28 Jan 12:17 composer.lock
drwxr-xr-x@ 21 user  staff   672B 28 Jan 12:16 docroot
drwxr-xr-x@ 39 user  staff   1.2K 28 Jan 12:17 vendor
~/example_repo/vendor$ ls -lha
drwxr-xr-x@ 39 user  staff   1.2K 28 Jan 12:17 .
drwxr-xr-x@ 11 user  staff   352B 28 Jan 11:04 ..
[...SNIP...]
drwxr-xr-x@  3 user  staff    96B  5 Nov 13:36 drush
~/example_repo/vendor/bin$  ls -lha
drwxr-xr-x@  9 user staff   288B  5 Nov 13:36 .
drwxr-xr-x@ 39 user staff   1.2K 28 Jan 12:17 ..
lrwxr-xr-x   1 user staff    20B  5 Nov 13:36 drush -> ../drush/drush/drush

Invoking Drush on Cloud Platform

Currently, Drush commands that do not specify a version of Drush default to Drush 8.

You can use Drush with your applications after you enable SSH access to connect to Cloud Platform using SSH.

Drush versions and Drupal

  • Drush 8 is the fully supported Drush version for Drupal 8.5 or earlier. Drush 10 is the fully supported Drush version for Drupal 9.x. Drush 11 or later is required for Drupal 10.x and later. You must use Composer to install Drush. For more information, see Installing Drush in your project.

Specifying a version of Drush in commands

If you do not use Drupal 10 and want to use the Drush versions supplied by Cloud Platform, you can run a specific version of Drush by specifying the major version after the drush command. For example, to run Drush 9, use the command drush9.

When you run Drush on your local machine and use a remote Drush alias for your Cloud Platform application, such as those described in Using Drush aliases, the remote Drush command runs the default version of Drush on Cloud Platform. Drush 8 or later attempts to determine if there is a project-specific version of Drush included, and hands off the process to the project specific version. However, that handoff is not always clean, and the platform’s default version may not be appropriate for the version of PHP or Drupal that you installed.

Acquia recommends that you run Drush commands by specifying the application docroot location, replacing [application] with your application and [env] with your environment, as shown in the following example:

drush --root=/var/www/html/[application].[env]/docroot

Finding help for Drush

To access help for Drush online, go to Drush Documentation.