---
title: "Drush and Drupal 7 on Cloud Platform"
date: "2024-02-14T06:18:38+00:00"
summary: "Streamline Drupal 7 development with Drush on Cloud Platform. Learn best practices for local and remote development, database access, and version management. Enhance your workflow today."
image:
type: "page"
url: "/acquia-cloud-platform/drush-and-drupal-7-cloud-platform"
id: "5c911a94-abe3-4761-87db-9c39f7a14c38"
---

Table of contents will be added

Note

This page is for Drupal 7 only. The [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version) requires Drush version 12 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](/acquia-cloud-platform/manage-apps/command-line/drush).

Drush is a command-line shell for Drupal, and it enables you to perform many administrative and application maintenance tasks from the command line instead of Drupal’s administrative interface.

Unless you are using Live Development, Drush cannot write to the Cloud Platform file system, so you cannot use it to manage your application’s code, or install or update modules. To manage your code, use your version control system, Git. As an alternative, you can enable the Live Development feature. With Live Development enabled, you can log into your Cloud Platform infrastructure and use Drush or other tools to write to the file system. You can use Live Development to modify only your Dev and Stage environments, not your Prod environment. For more information about Live Development, see [Using Live development mode to change code on your infrastructure](/acquia-cloud-platform/manage-apps/code/livedev).

Developing locally with Drush and Drupal 7
------------------------------------------

The fastest and easiest way to work with your application is to develop it on your local computer, rather than attempting to manage code or modules remotely on Cloud Platform. You can change your application’s code, use Drush locally to add or update modules, and then send the changes to Cloud Platform using your selected source control method (Git).

You can use Drush on Cloud Platform to help you develop locally. For example, suppose you want to be able to locally access your development environment database. To be able to access the database locally, [enable SSH, securely connect to](/acquia-cloud-platform/getting-started-ssh "Getting started with SSH") Cloud Platform, and then run the following Drush command, replacing `[env]` with your [environment name](/definitions/environment), and `[site]` with your subscription’s [sitename](/definitions/sitename):

Note

Drush commands should generally be run from your website’s [docroot](/definitions/docroot).

    drush @[site].[env] ah-sql-connect --env=[env] --site=[site]

The command provides the MySQL connection settings required to access the database. Replace `[site]` with your application’s name and `dev` with the environment whose database you want to reach. You can then provide these settings to a MySQL client installed on your computer (such as MySQL Workbench or Navicat). If your subscription is a [single-tier subscription](/definitions/tier), you can access your development environment’s database from your local computer after you configure the MySQL client to connect to the database infrastructure using an SSH tunnel.

Remote development - Drush resources on Cloud Platform
------------------------------------------------------

Drush is pre-installed on Cloud Platform, and you can use Drush with your applications after you [enable SSH access to connect to Cloud Platform using SSH](/acquia-cloud-platform/manage-apps/command-line/ssh/getting-started).

Using different versions of Drush on Drupal 7
---------------------------------------------

Cloud Platform can run most stable versions of Drush, from Drush 11 to Drush 5. Drush 8 is the default, recommended version.

Cloud Platform can run most stable versions of Drush, from Drush 13 to Drush 5. Drush 8 is the default, recommended version for Drupal 7.

Important

*   Cloud Platform defaults to the currently installed version of Drush 8.
*   Drush 9 and later are not supported with Drupal 7.

To run a specific version of Drush, specify the major version in the `drush` command. For example, to run Drush 7, use the command `drush7`. To run the default version of Drush, use the command `drush`. On Cloud Platform, the default version of Drush is currently Drush 8.

Note

Acquia strongly recommends that you always run a specific major version of Drush. Running the default version of Drush is dangerous because the behavior of your cron jobs, Cloud Hooks, or other automated scripts may change unexpectedly when a new version of Drush becomes the default.

If you want to change your personal default Drush version, you can set an alias for drush in a `.bashrc` file. For example, to make the `drush` command run Drush 7, add this to your `~/.bashrc` file:

    alias drush=drush7

This alias will work only for interactive SSH commands; it will have no effect during cron jobs or Cloud Hooks. To use a specific version of Drush in a cron command, you must call it directly, as follows:

    drush7

When you run Drush on your local computer and use a remote Drush alias for your Cloud Platform application (such as those described in [Using Drush aliases](/acquia-cloud-platform/manage-apps/command-line/drush/aliases)), the remote Drush command will be run using the default version of Drush on Cloud Platform. To run a specific version of Drush on Cloud Platform when you use a remote alias, edit the alias file in the `$HOME/.drush` folder on your local computer to specify the version you want. For example:

    $aliases['dev'] = array(
      'path-aliases' => array(
        '%drush-script' => 'drush7',
      ),
      // ... other alias settings here
    );

### Accessing environment databases

Each of an application’s environments on Cloud Platform has its own database, and when you use Drush to access these databases, you must refer to them specifically. For example, if you want to use `drush sql-connect` for the database in the development environment of your application, use the following command, replacing `[env]` with your [environment name](/definitions/environment), and `[site]` with your subscription’s [sitename](/definitions/sitename):

    drush @[site].[env] ah-sql-connect --env=[env] --site=[site]

### Finding help for Drush

*   To access help for Drush online, go to [Drush Commands](https://www.drush.org/13.x/).
*   To access command-line help, enter `drush help` on the command line while you are signed in to your Cloud Platform infrastructure. For a printable version of this list, enter the following command: `drush help --html`.

Related topics
--------------

*   [Introduction to Drush](/acquia-cloud-platform/help/93836-introduction-drush "Introduction to Drush")
*   [Using Drush aliases](/acquia-cloud-platform/manage-apps/command-line/drush/aliases)
*   [About SSH/Shell access](/acquia-cloud-platform/manage-apps/command-line)