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.

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.x

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_profile

Update Drush globally

$ composer global update drush/drush

Uninstall Drush

Maybe you will need this too.

$ composer global remove drush/drush

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.