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:
You’ll start in your user’s home directory:
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 (~):
Verify that Composer is installed:
✅ 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:
Confirm you’re in the correct folder by listing the contents:
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:
This command installs Drush inside:
Step 5: Verify the Drush Installation
To check if Drush is installed correctly, run:
You should see something like:
Next, test it with a Drupal command:
✅ You should get output similar to:
Step 6 (Optional): Make Drush Global
To use the drush command anywhere without typing vendor/bin/, create a symbolic link in your ~/bin folder:
Now test it globally:
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:
Troubleshooting Tips
- If
composerordrushisn’t recognized, make sure~/binit’s in your PATH. Log out and back in to refresh your session. - Always run
drushcommands from your Drupal root (~/public_html), unless you’ve made it global. - For permission issues, check file ownership using
ls -lahand 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):
-
Grant permission to the core Drush binary:
Bashchmod +x vendor/drush/drush/drush -
Ensure the vendor bin launchers are executable:
Bashchmod +x vendor/bin/drush -
Verify the fix:
Bashdrush --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.