If you're installing on a Shared server, you may hit your user's memory limits when running the commands below. If so, you need to contact support and ask that your user's memory limits be lifted so you can complete the installation.
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:
- Log into your server via SSH.
- View the creating and editing a file via SSH article for instructions on how to edit your existing .bash_profile. Add the following line if you’re using PHP 5.6. Change the number for a different version.
- Close the file and return to your shell.
- Activate this file by running the following.
[server]$ . ~/.bash_profile
- Create a phprc file. View the Adding a phprc file article for details.
- In this phprc file, add the following lines:
extension = phar.so suhosin.executor.include.whitelist = phar
- Kill off all running PHP processes.
[server]$ killall -9 php56.cgi
- Navigate to your your user’s directory.
[server]$ cd ~
- Then 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
Once you have installed Composer, run the following commands to install Drush.
- Run the following commands in your user’s directory:
[server]$ composer require drush/drush [server]$ drush init
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.
- Run the following command to confirm drush is functioning:
[server]$ drush topic