Install Drush for Drupal 8 on a CPanel web server

This proved much more difficult than it should have been, so I wrote this article.

$ drush --version

Install Drush globally

The after installing Drush 10, the “Drush version” command would work anywhere except inside a Drupal instance, useless I know. I kept getting this error whenever I ran “drush xxx”, “[warning] Drush command terminated abnormally.”. I eventually I removed Drush 10 and installed Drush 9, problem solved.

composer global require drush/drush:9.xCode language: PHP (php)

Add path to .bash_profile

# edit .bash_profile
$ nano ~/.bash_profile

# add this line
PATH=$HOME/.config/composer/vendor/bin:$PATH

# use newly modified .bash_profile
$ source ~/.bash_profileCode language: PHP (php)

Update Drush globally

$ composer global update drush/drushCode language: PHP (php)

Uninstall Drush

Maybe you will need this too.

$ composer global remove drush/drushCode language: PHP (php)

Alternate

composer require drush/drushCode language: JavaScript (javascript)

Troubleshooting

Error: “[warning] Drush command terminated abnormally.”
Was fixed by changing to a different version of Drush.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.