Drush

Drush is a command-line shell and scripting interface for Drupal. To use, you must have a shell user enabled and knowledge of the Unix shell.

Installing Drush using Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

Follow the instructions at https://github.com/drush-ops/drush:

  1. Log into your server via SSH.
  2. Edit the .bash_profile file.
    [server]$ nano .bash_profile
    
  3. Add the following line if you’re using PHP 5.6. Change the number for a different version.
    export PATH=/usr/local/php56/bin:$PATH
  4. When finished, press CTRL + O on your keyboard.
    • You are prompted to save the file.
  5. Click the Enter button to save.
  6. Finally, click Ctrl  + X to exit 'nano' and return to your shell.
  7. Update this file.
    [server]$ . ~/.bash_profile
    
  8. Create a phprc file. View the Adding a phprc file article for details.
  9. In this phprc file, use 'nano' again to add the following lines:
    extension = phar.so
    suhosin.executor.include.whitelist = phar
  10. Kill off all running PHP processes.
    [server]$ killall -9 php56.cgi
    
  11. In your user’s directory, run the following command:
    [server]$ curl -sS https://getcomposer.org/installer | php
    #!/usr/bin/env php
    All settings correct for using Composer
    Downloading...
    
    Composer successfully installed to: /home/exampleuser/composer.phar
    Use it: php composer.phar
    

Installing Drush on Shared

Once you have installed Composer, run the following commands to install Drush.

  1. Run the following commands in your user’s directory:
    [server]$ php composer.phar global require drush/drush:dev-master
    [server]$ php composer.phar global require drush/drush
    [server]$ php .config/composer/vendor/bin/drush.php 

    If you get a connection timed out error, you may be affected by this issue. If you have a private server you can use the /etc/gai.conf workaround mentioned there.

  2. Edit the .bash_profile file.
    [server]$ nano .bash_profile
    
  3. Add this line to your .bash_profile file:
    export PATH="$PATH:~/.config/composer/vendor/bin"
  4. When finished, press CTRL + O on your keyboard.
    • You are prompted to save the file.
  5. Click the Enter button to save.
  6. Finally, click Ctrl  + X to exit 'nano' and return to your shell.
  7. Run the following command to confirm drush is functioning:
    [server]$ drush topic
    

Installing Drush on VPS

See also

Internal links

External links

Did this article answer your questions?

Article last updated .