If you’re running a Drupal 11 or D10 website on GreenGeeks web hosting, you’ll need Composer and Drush to manage updates, configurations, and maintenance efficiently. This guide will walk you through the step-by-step process to install Composer and Drush on your GreenGeeks hosting account using SSH access.

What are Composer and Drush?

  • Composer is a PHP dependency manager used by Drupal to install and manage modules, themes, and libraries.
  • Drush (Drupal Shell) is a command-line interface that allows you to perform administrative and maintenance tasks quickly, such as clearing caches, running updates, and exporting configurations.

Prerequisites

Before you begin, make sure you have:

  • An active GreenGeeks hosting account (with cPanel access).
  • SSH access enabled (you can enable it from cPanel under “SSH Access”).
  • A Drupal 11 or Drupal 10 website is installed in your public_html directory.

Step 1: Log in to SSH

IMPORTANT! Make sure you already installed a Drupal website in your public_html as a pre-requirement.

Use an SSH client such as PuTTY, Terminal, or Windows PowerShell to log in to your hosting account:

ssh yourusername@yourdomain.com

You’ll start in your user’s home directory:

/home/yourusername/

Step 2: Install Composer

Composer needs to be installed globally so it can be used to manage your Drupal dependencies and Drush.

Run these commands from your root directory (~):

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
mkdir -p ~/bin
mv composer.phar ~/bin/composer
chmod +x ~/bin/composer

Verify that Composer is installed:

composer --version

✅ If you see something like Composer version 2.x.x, the installation was successful.

💡 Tip: If you get a “command not found” message, log out of SSH and back in so your ~/bin directory is added to your PATH.


Step 3: Navigate to Your Drupal Directory

Your Drupal 11 installation is typically located inside the public_html directory.

Go there by running:

cd ~/public_html

Confirm you’re in the correct folder by listing the contents:

ls

You should see Drupal directories such as core/, modules/, and themes/.


Step 4: Install Drush for Your Drupal 11 Site

IMPORTANT! Make sure you already installed a Drupal website in your public_html as a pre-requirement.

Now that Composer is working, you can install Drush locally for your Drupal site.

Run this command from inside the public_html directory:

composer require drush/drush

This command installs Drush inside:

~/public_html/vendor/drush/drush

Step 5: Verify the Drush Installation

To check if Drush is installed correctly, run:

vendor/bin/drush --version

You should see something like:

Drush Commandline Tool 13.x (compatible with Drupal 11)

Next, test it with a Drupal command:

vendor/bin/drush status

✅ You should get output similar to:

Drupal version : 11.x
Database : Connected
Drush version : 13.x

Step 6 (Optional): Make Drush Global

To use the drush command anywhere without typing vendor/bin/, create a symbolic link in your ~/bin folder:

ln -s ~/public_html/vendor/bin/drush ~/bin/drush

Now test it globally:

drush --version

Common Drush Commands for Drupal 11

Once installed, you can use Drush to manage your Drupal site efficiently.
Here are a few essential commands:

Command Description
drush status Displays site information and connection details
drush cr Clears all Drupal caches
drush updb Runs pending database updates
drush cim Imports configuration from your sync directory
drush cex Exports configuration files
drush uli Generates a one-time login link for admin access

Step 7 (Optional): Clean Up Installation Files

To keep your root directory tidy, remove the Composer setup files:

rm -f ~/composer-setup.php

Troubleshooting Tips

  • If composer or drush isn’t recognized, make sure ~/bin it’s in your PATH. Log out and back in to refresh your session.
  • Always run drush commands from your Drupal root (~/public_html), unless you’ve made it global.
  • For permission issues, check file ownership using ls -lah and ensure PHP CLI matches your site’s PHP version.

Troubleshooting: “Permission Denied” After Drush Installation

When migrating a Drupal 11 site or performing a fresh install via Composer, you may encounter an error similar to:exec: /home/user/public_html/vendor/drush/drush/drush: cannot execute: Permission denied

This typically occurs even if you have successfully created a symbolic link (symlink) to Drush in your ~/bin folder. The issue lies in the file system permissions of the source binary within the vendor directory.

The Problem

During file transfers (via SCP, FTP, or Git) or during certain composer install routines, the execution bit for the Drush binary can be lost. Linux treats the file as a standard text file rather than an executable program, causing the shell to block its operation for security.

The Solution: Restoring the Execute Bit

To fix this, you must explicitly grant “execute” permissions to the Drush binary and its associated launchers. Run the following commands from your site root (e.g., ~/public_html):

  1. Grant permission to the core Drush binary:

    Bash
    chmod +x vendor/drush/drush/drush
    
  2. Ensure the vendor bin launchers are executable:

    Bash
    chmod +x vendor/bin/drush
  3. Verify the fix:

    Bash
    drush --version
    

Conclusion

Installing Composer and Drush on your GreenGeeks hosting account makes Drupal 11 management faster and easier. With these tools, you can efficiently handle updates, configuration imports, and site maintenance directly from the command line.

By following the steps above, your Drupal 11 site on GreenGeeks will be equipped for professional-level management and automation.


Related Resources