Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

If you have ever tried to install Drush for administering Drupal on any shared hosting package, you will know it is a devilishly difficult task to get right!

Some hosting firms supply some written information on how to achieve this. 1&1 is not one of them. Having just slogged through the whole process myself, I thought I would share the steps I found worked for me (note, these steps are nearly all adapted from the official Drush install instructions and a few other sources around the web, see the list below for acknowledgements and references)

Before installing any sites, I set all my domains to use PHP v5.5

Open an SSH terminal session to your hosting account (I recommend using the Bitvise SSH client) and type the following to install the Composer package:

1
curl -sS https://getcomposer.org/installer | php5.5

Next, run Composer and instruct it to install Drush and all dependencies:

1
php5.5-cli composer.phar global require drush/drush:dev-master

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Create a bash profile file (.profile) in the root of your webspace with the following contents (N.B. please see the comments below as some have found it necessary to replace “$HOME” with “./composer” or fully typing in your complete home path in the first “export” instruction):

1
2
export PATH="$HOME/vendor/bin:$PATH"
export DRUSH_PHP=/usr/bin/php5.5-cli

Edit the file /vendor/drush/drush/drush.php and add the following ‘if statement’ (lines 4-15) between the first <?php line and the following /** line:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env php
<?php
 
if (!defined('STDIN')) 
{
 define('STDIN', fopen('php://stdin', 'r')); 
} 
if (!defined('STDOUT')) 
{ 
 define('STDOUT', fopen('php://stdout', 'w')); 
}
if (!defined('STDERR')) 
{
 define('STDERR', fopen('php://stderr', 'w')); 
} 
 
/**
 * @file
 * drush is a PHP script implementing a command line shell for Drupal.
 *
 * @requires PHP CLI 5.3.0, or newer.
 */

Log out of your SSH session and log back in again to load the newly create bash profile.
You should now have a fully operational installation of Drush.

 

References

Main Drush installation instructions – http://www.drush.org/

1&1 Hosting – http://www.1and1.co.uk/

Tweaks to drush.php by Jeremy Hislop – http://jheslop.com/2012/10/30/drush-on-1and1-shared-hosting-cg/

Share