Search code examples
drupal-7drush

How to intall drush on hostgator servers


I would like to have Drush on Hostgator shared hosting. I just spent 1 hour trying various outdated tutorials (Drush now requires composer). Does somebody have proved, tested and working solution how to install Drush there? I'm using PHP 5.4.

My last achieved step is drush st error:

Unable to load autoload.php. Drush now requires Composer in order to install its dependencies and autoload classes. Please see README.md
Content-type: text/html

When I run php composer.phar diagnose I see:

Content-type: text/html

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking disk free space: OK
Checking composer version: OK

Solution

  • Incase it helps others, I had been using a variety of google inspired resources to install Drush, which just complicated the situation for me. I would highly recommend following the official documentation which is the main source of information. I even read on there that they only maintain the documentation here, not even on drupal.org.

    I was missing this step based on other instructions, Now add Drush to your system path by placing export

    PATH="$HOME/.composer/vendor/bin:$PATH"

    into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).

    These instructions helped me resolve the error:

    curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ln -s /usr/local/bin/composer /usr/bin/composer

    git clone https://github.com/drush-ops/drush.git /usr/local/src/drush cd /usr/local/src/drush git checkout 7.0.0-alpha5 #or whatever version you want. ln -s /usr/local/src/drush/drush /usr/bin/drush composer install drush --version