These instructions are for installing older versions of Drush that pre-date the Composer requirement. Please try to install Drush using the method in Installing Drush 6 and 7 on Shared Hosting Accounts first, unless you need an older version of Drush, or you cannot install Composer on your shared host.

  1. If you don't already have shell access, request access to SSH for your shared hosting account (e.g. for Hostmonster or Green Geeks: open a new support ticket with Tech Support (UPDATE: Shell access can now be enabled from cPanel for some hostmonster hosting accounts). For other Hosting services you may need to upgrade to use SSH.)
  2. Once you have received SSH access to your site, open a new Terminal and login to your site by typing the following ssh username@yourdomain.com or any additional user login string provided by your Hosting service
  3. Enter your password when prompted
  4. By default, you should be in your home directory (~). If you are not in your home directory, navigate yourself there by using the cd ~ (cd = change directory command). The '~' is an alias for your home directory. On Hostmonster--and nearly every other Linux shared hosting situation--your website directory is located at ~/public_html.
  5. Confirm you are in your home directory by typing the bash shell command ls, which will list the files and folders in the current directory. On Hostmonster, you should see public_html/, public_ftp, and a bunch of other files. Make special note of a file named .bashrc, as we will be editing it later.
  6. Download Drush by typing wget https://github.com/drush-ops/drush/archive/6.1.0.zip (Drush 6.1.0 is the last version of Drush that doesn't require Composer). Extract the .zip file by typing in unzip drush-6.1.0.zip and remove the zip file by typing rm drush-6.1.0.zip.

    *Tip: type clear and hit enter. This will clear your screen, allow you to read the screen more easily. Do this as much as you want to throughout this process.
    **Important: If your host's configuration does not allow for the wget command, you may alternately download the zip file referenced above manually and upload and extract via the host's cPanel File Manager, or an ftp program of your choice.
  7. Type ls again, to list your directory. You should now see drush/ in the directory (if the directory is drush-6.x, rename to drush with mv command).
  8. Next, in order to use Drush across our installation&emdash;in all of our sub-folders&emdash;we need to add a line to our .bashrc file (Please note: some Web hosts that use Free BSD or other UNIX operating systems may not have a .bashrc file, but a .cshrc file, which you edit in the same manner). While still in your home directory, type the following: nano .bashrc. This will open up .bashrc in a text editor named nano.
    *note: For GoDaddy accounts there is no nano application (for new cPanel accounts nano is available). Use VIM instead. So type vim .bashrc to edit the file. A good VIM cheatsheet is: http://www.fprintf.net/vimCheatSheet.html]
    Locate # User specific aliases and functions. Underneath that, add the following: alias drush="~/drush/drush". Save the file by typing ctrl+X (Exit) and type y to accept your changes. Please note: the exact symbols for this alias may vary from host to host. If the alias given here doesn't work, you may want to try with single instead of double quotes, or without the = symbol.
  9. Type source ~/.bashrc to refresh the alias list and allow the new drush commands to work.
  10. Confirm that Drush is working by typing drush at the command prompt and hitting enter. You should see a list of drush commands. If you do, then success!
  11. If the previous step doesn't work, type exit to end your SSH session, then log back in (See step 2) to restart your session. This refreshes .bashrc and allows the new drush commands to work. Some hosting providers such as GoDaddy (legacy accounts) use php-cgi in the command line instead of php-cli. The former is not compatible with Drush and if this is your case you have to locate php-cli and then add the following lines to your ~/.bashrc or ~/.bash-profile file:
    export COLUMNS
    alias drush='/usr/local/php5/bin/php ~/drush/drush.php'
    alias php='/usr/local/php5/bin/php'
    

    You can locate the current path for the php-cli program by typing whereis php-cli. The path that this returns should be what is in the first part of your alias statements, i.e. 'usr/local/php5/bin/php'.

  12. You have now added drush hot sauce to your shared host. Awesome!

Once again, this should work on any shared hosting Linux platforms that allow shell access. On Hostmonster or Green Geeks, you have to specifically ask them to turn it on. If you do not have a .bashrc file in your home directory, try making it by typing touch .bashrc. You can also try using a file named .profile, .bash_aliases or .bash_profile, depending on your server's setup. If you run into trouble consult your host's documentation or Knowledge Base.

SSH config

Since you'll be using the ssh login prompt a lot, you might consider creating a local alias for your login credentials. Follow this link for detailed instructions. Note that in a Drush site-alias configuration you would use the host name configured in this file as remote-host and no remote-user.

Editorial Comments

For all those who didn't really understand the instructions and are just trying to follow it as it is written, here's a bit of advice: only use Drush if you start to understand it, even a little bit. Shell commands and Drush commands are very powerful and not recommended for learning on production sites or sites with a live server deadline, because you can mess things up very quickly. Your Shared Hosting support won't be happy if you create code loops through failure.

Another bit of advice: If you are not a full-time developer, you should always use the stable non-beta releases of Drush, and should never use the additional -y command to avoid the security question "are you sure you want ... ? y/n.

To put it another way: Read the instructions twice, understand what the commands mean and what they do, don't rely solely on copy/paste. In the long run, you will save your self time--which is the whole point of Drush in the first place.

Let's take the alias command as an example; you can exchange the .bashrc alias line with something else like alias ddd='~/drush/drush' instead of alias drush='~/drush/drush'. This actually changes the way you use the Drush command later. Your commands will start with ddd [your command] then, instead of drush [your command]. And you can also add other aliases of course, like: alias dddl='~drush/drush en' , which simplifies thee often-used Drush 'en' command from drush dl to dddl. In short, it is well worth your time (and safer) to go ahead and learn how to properly use Bash commands, if you plan on using Drush.

The Drush Documentation is a great place to start. It will teach you about Drush commands, and how to use them.

Comments

kristin.e’s picture

I have followed the above instructions to the letter and when I log back into remote server I keep getting drush: command not found.

One thing I did notice was that my .bashrc was empty. I then created one by typing touch .bashrc and it doesn't come up when I type ls when in my home folder. I can edit it with the nano command but it still isn't listed. What could the problem be?

Anthony Pero’s picture

If you had an empty .bashrc file, you need to add your alias to that file, not create a new one.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

kristin.e’s picture

Thanks for your reply. I did just edit the .bashrc file to begin with but when I got the drush: command not found I created the .bashrc file.

Anthony Pero’s picture

Are you on Hostmonster?

Verify that your folder structure is ~/drush/drush.php, and ~/drush/drush

Try copying this into your .bashrc document:

# .bashrc

# User specific aliases and functions

alias drush="~/drush/drush"

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

That's what mine says, on Hostmonster. It said everything except alias drush="etc..." when I first opened it.

If you are not on hostmonster, see if you have a .bash_profile file in ~, and add the line to that file instead.

If none of this works, try typing alias drush="~/drush/drush" at the command prompt, and see if drush works then. If it doesn't work then, you need to try starting over, because something didn't download or unpack right. If that does work, then the issue is with the bashrc file. You may need to ask Hostmonster for support.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

kristin.e’s picture

Thanks so much for your advice @Anthony Pero I now got it working by typing alias drush="~/drush/drush". Thanks for a great tutorial.

Anthony Pero’s picture

Just to be clear: typing alias drush="~/drush/drush" at the command prompt is not persistent. It will only work for your session. As soon as you close your terminal, it won't work anymore, and you'll have to type it again. This was just to test to see if Drush was installed correctly. If you got it working that way, then it's installed correctly, and the issue is with the .bashrc file. Something is not right. Hostmonster's tech support is awesome, and they will get you squared away.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

kristin.e’s picture

Hi again, thanks I figured I had to create a .bash_profile as well in order to have a permanent drush set up rather than temporary as you described above. Putting the drush alias into .bash-profile as well did the trick. I'm not with Hostmonster but another shared hosting environment.

I've now come across a new problem in that my site-aliases (as opposed to drush alias) just keep returning "jailshell: drush command not found" - but I realise that is another issue entirely and not covered by this post so will go a hunting elsewhere for answers. Of course if you can point me to any info on that issue please do.

Thanks for all the support so far.

arborrow’s picture

I had drush installed and working fine if I logged in via ssh to the site; however, I was wanting to be able to use aliases and was getting the message:

bash: drush: command not found

I ended up adding:

'path-aliases' => array (
'%drush' => '/home7/{your hostmonster username}/drush',
'%drush-script' => '/home7/{your hostmonsters username}/drush/drush'

to my drush aliases file and then I was able to do what I wanted. I hope this helps if anyone else is having this trouble. I do agree that Hostmonster support is top notch but I did not need to call them for this.

Peace - Anthony

p.s. keep in mind that they occasionally move home around a bit - on my install the actually directory was /home7 - I tried just using ~ but that did not work as it seems to want an absolute path.

csmcreative’s picture

I was having the issues and have been helping someone on a UNIX server hosted with pair.com (pair networks). While they don't help you too much since they sell this type of service, I felt comfortable that it was possible.
The biggest problem with everyone's 'solution' is that every environment is setup differently. I didn't even have the .bashrc file, but there was a .cshrc. I added the aliases there and fiddled around a bit and finally got it to work by using :
alias drush '~/drush/drush'
Others have slightly different syntax with '=' signs. I just referenced the other aliases in the .cshrc file and saw how they were formatted and now I am good to go. I didn't have much luck setting up PEAR like others said due to some fopen error but as of now, I don't think I need it.
I did a quick 'drush dl admin_menu' and it downloaded fine. Definitely a bit of a headache when working on shared servers with limited control but hopefully this will help others.
I will update you all if I have other issues but for now, I am glad it works!

thinkinkless’s picture

i just moved to a new server on pair and found drush was not being found. your post saved be a lot of trial/error!
don't forget to:
% source ~/.cshrc

for the new alias to get picked up.
cheers and hope this helps others. drupal without drush pretty much sucks.

birdahonk’s picture

I just spent an embarrassing amount of time trying to figure out what I was getting the "Command not found" message (I'm also using Pair Networks and had the .cshrc file instead of the .bashrc file). mollyFlogger's solution fixed it immediately. My .cshrc file didn't have any other alias examples to reference so I spun my wheels a bit.

I guess all my wasted time is dues paid by a 'nix n00B. Oh well, thanks for the solution.

karolus’s picture

Thanks--
This was the solution I needed! Surprisingly, contacting Pair's tech support didn't uncover this. I will be sure to let them know about this...

smokefree’s picture

You can make it a bit easier by replacing lines 6-12 with the following:

After confirming that you are in your home directory as per #5 type the following statement

wget -O - http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz | tar -zxf -

replace http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz above with the current link.

(I find it easiest to assemble the statement in notepad or similar, to make sure it's absolutely
correct, and then cut and paste into my terminal, but any way that works is good.)

This will download drush and create a directory called drush in your home directory and expand the contents of the tar file in one nice clean step.

[Optional - or just skip to Step 13]

If there is any doubt that things worked you can verify by typing:

cd drush
ls

You should see something like

LICENSE.txt commands drush drush.info drush_logo-black.png includes
README.txt docs drush.bat drush.php examples

then type cd ~

to get back to your home directory and carry on with step 13

P.S.: Thanks for the great tutorial.... solid work!

brentini’s picture

I just want to confirm for any folks who might be wondering, that this installed fine on Bluehost. Just follow all of the instructions above. But the first thing you need to do is enable ssh access in CPanel. It is in the security section of CPanel.

It was very easy and now I can use Drush on my Bluehost account! Thank you very much for this easy and concise tutorial!

avanvlack2’s picture

These steps worked very well for a drush installation newbie, thanks so much!

anruether’s picture

Anybody who knows a solution for the managed vserver on hosteurope? No access to .bashrc, support says, they can't do anything about it...

Anthony Pero’s picture

try .bash_profile

EDIT: Alternately you can always type in the alias at the command line every time you log in.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

ntrepid8’s picture

One problem I ran into on many shared hosting environments is that only php CGI is installed. I've read in some places that drush can run with php CGI, but I was not able to make it work correctly without php CLI. Drush is already configured and ready to use.

edited by silverwing - removed potential advert sentence

-ds-’s picture

A NOTE TO POINT 15:

What this point does not make clear is that drush commands will only work when run from inside your drupal install directory!

If you are outside your drupal installation folder, which you could easily presume from the way the above guide is written, and try to test your install of drush, you will at least receive this type of error

A Drupal installation directory could not be found                       [error]

so first enter your drupal install directory with the normal cd directory_name command and then run a drush command and it should work.

Anthony Pero’s picture

Thank you for pointing this out. It is a good tip. However, it is not strictly true. Some Drush commands work system wide, other wise you wouldn't be able to download drupal and install it with Drush. The command given in Step 15 will work in any folder, anywhere in your system.

The great thing about the Drupal documentation is that any one can edit it. Please feel free to edit the point so it reads more correctly in the future.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

AlanO’s picture

It seems I have installed it correctly and the path seems to work. Although I have to manually input it every time I log in. I do have a problem though. I get this error even if I'm inside a drupal directory.

/home/SITENAME/drush/drush: line 39: tput: command not found
Content-type: text/html
AlanO’s picture

Okay, I found out the problem is at executing the script part. I had to set up the alias like this...

alias drush="/usr/local/php52/bin/php-cli ~/drush/drush.php"

the "/usr...php-cli" part is the location of the php command line interface which executes scripts, I assume. Also, php52 is the version I'm running on my shared host. Make sure you do the same thing. If you don't know what yours is, check the status report in your hosted drupal site and check the version you're using.

I also noticed that after creating the .bashrc file I got a weird looking -bash-3.2-$ for my command prompt. I didn't like and found out that putting this code in the .bashrc file help put it back to normal interface.

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

My host was Siteground and I hope this message helps anyone else trying to add drush to their site.

Anthony Pero’s picture

If you can still edit your post, could you change the title to reflect that this is the solution on Siteground? That will help in search results.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

TheodorosPloumis’s picture

I see that I have to repeat step 14

Type source ~/.bashrc to refresh the alias list and allow the new drush commands to work.

every time I want to use Drush in my shared hosting.
Otherwise it says "Command not found" when I type drush in the command shell.

TheodorosPloumis.com - Drupal developer @ eworx.gr.

drdave17’s picture

strike

drdave17’s picture

I got as far as step 14
While in the bashrc editor I deleted some of the text by accident while backspacing just below "# User specific aliases and functions." so I exited bashrc and went back to step 13.

Don't remember what happened after that but I exited putty altogether and when I tried to get back in I got error
-bash: /home2/mysite/.bashrc: line 4: unexpected EOF while looking for matching `"' - bash-3.2$

Typed drush and got "Command Not Found".

At that point I just deleted all my Drupal files and reinstalled with a clean database.

My question now is how do I get rid of drush so I can start over clean? Or what do you recommend?

Thanks
Dave

Anthony Pero’s picture

Delete the folder where you unpacked drush. Ask your host if there is a backup copy of your .bashrc file, or if they can provide a fresh copy for you. This should restore everything. If your .bashrc file is fine, all you need to do is remove the drush directory.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

Anthony Pero’s picture

If you are on hostmonster, here is what my .bashrc file looks like... you may just be able to copy this into yours, without deleting drush, and drush might work, then.

# .bashrc

# User specific aliases and functions
alias drush="~/drush/drush"

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

drdave17’s picture

Bluehost is looking into the problem. If not a fix I'd like to know if someone else might have the bashrc code for bluehost maybe?

Lastly, how do I prevent this from happening again?

Thanks folks

drdave17’s picture

Their response not very helpful at all. I haven't touched this file.

>>Looks like you have some custom settings in the .bashrc file. The error message you gave is says it has a syntax error.
Have you tried removing or commenting out the line that says: alias drush=~/drush/drush?

For alias's, you may need to put single quote characters (') around the ~/drush/drush for the alias to work.<<

Anthony Pero’s picture

Post the content of your bashrc file here. Surround it with the code tag.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

drdave17’s picture

Not much in this file...

# .bashrc

# User specific aliases and functions
alias drush=~/drush/drush
# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi
Anthony Pero’s picture

You are missing the quotes around the drush path... this is what you need it to say:

# .bashrc

# User specific aliases and functions
alias drush="~/drush/drush"

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

drdave17’s picture

Bluehost restored the file after all. They also placed a backup in /etc/bashrc

I will keep your copy handy in case I ever need to do this.

Thanks a lot!

aberger’s picture

GoDaddy Shared Hosting allows you to create your own bash aliases in ~/.bash_profile, which is useful for using SSH to log in and use Drush on their servers, but is useless for remote calls to Drush via SSH. A call to drush @remote-site status will complain bash: drush: command not found.

To get remote calls working, you must specify GoDaddy's PHP binary in php and the path to drush.php in %drush-script for the remote alias:

$aliases['remote-site'] = array(
  'php' => '/path/to/php',
  'path-aliases' => array(
    '%drush-script' => '/path/to/drush.php',
  ),
  // ... additional alias config
);

Without the .php extension, Drush will try to execute drush ...remote...command... over SSH, which sucks because there is no drush command on GoDaddy's PATH. This way, Drush will call /path/to/php /path/to/drush.php ...remote...command... over SSH instead.

As of this writing, GoDaddy's PHP binary is /usr/local/php5/bin/php.

I was surprised that it took me three hours of useless blog posts to figure this out on my own.

Rajesh Dhyani’s picture

@aberger ,
Many thanks for this. Does this piece of code go into .bash_profile?

Your help is appreciated.
RD

jci’s picture

saved me my weekend ...

frederico’s picture

Thank you for this procedure!! Very good detail on the instructions. I had to copy over example.drush.ini over to the drush sub-directory and remove the comment notation from the following line: safe_mode= and then it worked great. Thanks again!

-Frederico Garza

tusik’s picture

Followed your checklist and worked like magic.

Now because I'm sooooooo new to command lines and drush and such, before actually doing doing anything with it, I need to ask. So in my public_html I have several subfolders, each of them is a site. I do not used a shared installation of drupal, but there is a drupal install for each folder.

Let's say:

-public_hmtl
- SiteA
- SiteB
- SiteC
and so on...

So if I want to execute a core update for Site A ONLY, let's say, ( not Site B, Site C), etc. Where exactly should I be?
in

public_html/SiteA or in public_html/SiteA/sites/default

And for sure it won't affect anything above that folder, right? The other installs are safe and sound, right?

Almost sure that public_html/SiteA is the answer but I would like to confirm, before ...well...crying. :)

dieppon’s picture

Drush commands given will work for your site and your site only, as long as you are inside the Drupal directory, in this case SiteA.

tusik’s picture

I have my test site in folder SiteA and will do all drush tests there so I wanted to make sure.

tusik’s picture

I have already SUCCESSFULLY performed the update of drupal core for SiteA, now I have a drupal website ALSO in the root.
Will executing the drupal core update drush command right in the public_html folder, affect the websites in the subfolders ???

Anthony Pero’s picture

I don't believe so. I'm pretty sure of that.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

tusik’s picture

Went ahead and just did it. No effect on the subfolders. I suppose it follows the sites/default/config file and acts from there.

PedroKTFC’s picture

Just to confirm how I went with a shared hosting package on 1and1.

I followed the instructions and all went well. A couple of changes though. On my host I had to put the following lines in .bash_profile

alias drush='/usr/local/bin/php5 ~/drush/drush.php'
export COLUMNS

However, to get drush to work remotely I had to add the following to the aliases.drushrc.php file (names changed to protect the guilty):

$aliases['remote'] = array(
  'remote-host' => 'remote.websitehome.co.uk',
  'root' => '/kunden/homepages/your-remote-directory',
  'uri' => 'remote.websitehome.co.uk',
  'remote-user'  => 'user',
  'php' => '/usr/local/bin/php5',
  'path-aliases' => array(
    '%drush-script' => '/kunden/homepages/bit-in-between/htdocs/drush/drush.php')
);

Good luck!

Anonymous’s picture

I've recently struggled with this issue and after many failed corrective measures, here is how it was overcome. The error I was getting stated that the allowed memory of 57000000 was exhausted. I was simply trying to upgrade drupal core using the DRUSH UP DRUPAL command. When I used the various commands to determine how much memory I had my shared hosting service reported 128MB.

1. Drush will seek and load a php.ini file found in the drush folder before it searches out your PHP CLI php.ini location. So, grab the example.drush.ini file from examples folder (within the drush folder) and rename it php.ini and place it in the drush/ folder. There was only the memory_limit and the error_reporting lines active.

2. After I did this I started gettting errors that it couldn't find a valid drupal install..., bootstrap errors occurred even though I was running the command from public_html file. So I added to my new php.ini file these commands:
zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.2.so"
extension=timezonedb.so
extension=mailparse.so
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

3. After adding these the command finally worked. If you review your php.ini file found in the CLI location [my case it's /usr/local/lib/php.ini] you will see many other commands. You may need to add some of these other commands if you have other errors. Add them one at a time and test.

Hope this help those who are struggling.

munge83’s picture

This solved my problem. I searched the web for 3 hours until I stumbled upon this comment. Thanks emag!
Is this some kind of bug ?

hosais’s picture

Hi all,

Uf, finally I can use drush without erros now. I Just would like to share my experience so that it can save other people's time.

I spent 3 hrs to install successfully. One thing special is that I cannot use drush* to execute. The only way is explicitly run "php_cli drush.php".

After the installation, I have memory exhausted problem when I disable one module (only one module that without any dependency). I tried to add drash.ini and php.ini in drash directory. it still does not work. The drush status showed that drush knew these two files but the memroy lmit is always 128M.

Then I spent another 3 hrs try to make it work. Finally, I EXPLICITLY add php.ini by php_cli -c <my.php.ini> drush.php command. O, it works ....

hosais

casti2525’s picture

Installed Drush on Bluehost in a minute, thx guys!

joyseeker’s picture

I used to be on Bluehost, and I easily got Drush up with a little help for the path from tech support in a couple of minutes.

Now on my MyHosting.com VPS system, Drush isn't working. I've been emailing tech support all day, and they said they have not idea what's up and then said it's beyond their scope. Finally, I got an email from tech support person who wants to charge me $90 for an hour's work to get Drush working. What?

So, is a VPS system configured so differently that they have to charge an extra amount to get it working? Or is just a foreign tech support treating a woman with no respect?

Susan

Anthony Pero’s picture

VPS is definitely different. It can be configured any number of ways. In many cases, you have complete control over configuration. Is yours referred to as a "managed" vps? What Operating system is it running? If you are on a Debian or Ubuntu platform, installing drush can be really, really simple, and there are instructions on this site for how to do it. Let me know more about your VPS, and I'll try to point you in the right direction.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

mrtoner’s picture

I had an issue where Drush was not finding the root of my Drupal installation. The problem was that when drushrc.php was created, the incorrect base directory was specified:

// Specify your Drupal core base directory (useful if you use symlinks).
# $options['r'] = '/home/USER/workspace/drupal-6';

Not sure how this happened, since I followed the instructions above and didn't touch drushrc.php, but once I changed this

$options['r'] = '/home/USER/d7';

to this:

$options['r'] = '/home/USER/public_html/d7';

it worked.

Carolina Tiger Rescue’s picture

getting by with a little help from my friends, this page, and walk-through instructions on this link: http://willjackson.org/blog/installing-drush-godaddy-shared-linux-hosting, I was able to install Drush on our GoDaddy host.

Eureka, it works!

now to just figure out how to upgrade with Drush...

HTH someone else, Amanda

WebDux.com’s picture

I am using HostMonster shared host and trying to install drush as aboved instruction.

But after I finish the installation and type drush, it "syntax error near unexpected token `newline' " error tips.

/home2/username/drush: line 6: syntax error near unexpected token `newline'
/home2/username/drush: line 6: `'

Is there anyboy could help me to fix the problem, please?

Geijutsuka’s picture

The documentation was just updated with the correct alias to the Drush install on GitHub. Sorry for any confusion. I've been going through this process for the last couple of days on Bluehost and updated as I went. You'll have to remove your Drush directory and wget again.

WebDux.com’s picture

Hi dear Geijutsuka,

So many thanks for your quick and useful reply. I have installed the drush successfully and upgrade our Drupal.

By the way, if there is any code that I can only check the modules which need to update then we can update the modules separately because there are some modules we don't need to update.

Geijutsuka’s picture

WebDux.com -

You can get of all your available drush commands by typing in drush help. If you want to see a list of updates, type in drush ups. You can find a list of update commands and their arguments here: http://drushcommands.com/#pm-update

Warning: Always use Drush with caution.

Contact me directly if you have any more questions--comment threads aren't the best place for conversations.

Anthony Pero’s picture

Also, you can use https://drupal.org/project/update_advanced to "pin" certain versions of modules, and prevent them from updating automatically while updating with Drush.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

g35nightrider’s picture

Thanks for the instructions Worked on Hostgator! Drush life!

kopeboy’s picture

My hosting says they will activate SSH access only if I tell them the IP address I will use to access.

Is this request normal?? How can I know the IP I will have?

Thanks

JamesOakley’s picture

Hopefully you've got around this limitation by now, as this was 6 weeks or so back. But I see nobody answered the question:

Some hosts are cautious about giving SSH access. A good reason to be cautious is that people sometimes ask for it without knowing what they're doing - the host doesn't want lots of people opening tickets to say "I've broken it". A bad reason to be cautious is if they think SSH is insecure - it's no more insecure than, say, cron, so if their security policy relies on not giving people SSH access it's not a good start.

How can you know the IP you'll use? If you connect through the internet connection at work / college etc, the chances are it will always be the same. Use whatismyip.com to find it. If you connect at home, it all depends on your ISP. Some ISPs give subscribers a "static" IP (it's the same each time you connect); most, especially cheaper ones, allocate you any IP from their pool each time you reconnect. If that's the case, you cannot give your host your specific IP.


This signature is currently blank
Steve -cc’s picture

It looks like Anthony updated this to reflect Drush being moved to Github. I downloaded the Zip file from the main Github project page - https://github.com/drush-ops/drush/archive/master.zip

Got thru all of the instructions and drush tried to run but threw error -

Unable to load
autoload.php. Drush now requires Composer in order to install its depedencies
and autoload classes. Please see README.md

I did not see any mention of this in these Docs. Is this new? or do the instructions need to be updated some more? or did I download and extract the wrong file?

Thanks,

Steve

Anthony Pero’s picture

What host are you using, Steve? And what package did you purchase from them?

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

Steve -cc’s picture

Nearly Free Speech - nearlyfreespeech.net

Anthony Pero’s picture

Did the two comments below help you, Steve?

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

datarazor’s picture

My name isn't Steve but the two comments below both fail for different reasons. :-(

datarazor’s picture

[deleted duplicate]

murrow’s picture

Download composer (possibly to your drush directory):

: wget https://getcomposer.org/download/1.0.0-alpha8/composer.phar

Then run the following to complete the drush installation:

: php composer.phar install

datarazor’s picture

Dl'd Composer into the drush directory.

Trying this out and getting:

# php composer.phar install

Fatal error: Class 'Phar' not found in /home/fountain/drush/composer.phar on line 13

Any ideas? Google doesn't turn up much.

dopshvotal’s picture

php-cli -r "readfile('https://getcomposer.org/installer');" | php

cd ~/.composer/vendor/bin

php-cli ./composer.phar global require drush/drush:6.*

nano ~/.bashrc

alias drush="~/.composer/vendor/bin/drush"

source ~/.bashrc

datarazor’s picture

First line of command gives:

Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The suhosin.executor.include.whitelist setting is incorrect.
Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):
    suhosin.executor.include.whitelist = phar 

The php.ini used by your command-line PHP is: /usr/local/lib/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

The phar extension is missing.
Install it or recompile php without --disable-phar

The php.ini used by your command-line PHP is: /usr/local/lib/php.ini
If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.

This is a shared host, no root or sudo access.

lu_smithcon’s picture

The comment for installing on Hostmonster didn't quite work for me or I was missing something. Here's what worked:

cd bin/
wget https://getcomposer.org/installer
php installer
rm -f installer
php-cli ./composer.phar global require drush/drush:6.*

Add the following to .bashrc
alias php="php -d disable_functions="
alias composer="php-cli ~/bin/composer.phar"
alias drush="~/.composer/vendor/bin/drush"

Get it to reload .bashrc
source ~/.bashrc

hepabolu’s picture

First off, excellent tutorial, I found it very helpful to set up Drush on SiteGround. Note: SiteGround already offers Drush installed, but I wanted to control my own version, so I followed these instructions (and all comments). I have drush 6.2 installed in ~/bin/drush. I've added this directory to my path and since SiteGround offers an environment variable DRUSH_PHP pointing to the php-cli location, I've created an alias alias drush="$DRUSH_PHP ~/bin/drush/drush".

Remarks: some comments refer to step 14 and 15, but these are no longer available. It would be nice if there was some indication of what they were originally, so readers are not left wondering if there are steps missing.

Questions:

  • I've added the path to Drush + the alias to my .bashrc (which is included in .bash_profile by default). This works fine when I SSH into the account and perform Drush actions. However, when doing a drush @remote-site status, which basically repeats my manual action, I still need to provide the path to php-cli and the full path to the drush installation in the site-alias configuration. I would assume that the SSH command would pick up the contents of .bashrc, but apparently not. Does it pick up any such config file? If yes, which one?
     
  • Turns out it doesn't work completely. This is what I experience:
    • ssh into the account; cd to the Drupal site root
    • run drush status -> correct status output
    • run ~/bin/drush/drush status (bypassing the alias) -> 'no tput' message and correct status output
    • run drush pm-update -> error (see below)
    • run ~/bin/drush/drush pm-update -> 'no tput' message and correct message

    To add to the confusion: if I do both drush commands from my local machine, using the remote site alias, both work as intended, i.e.
    drush @remote status and drush @remote pm-update both give the correct output.


    Any idea how to solve this?

Error:

Illegal string offset 'site' backend.inc:1013                          [warning]
The command could not be executed successfully (returned:                [error]
Content-type: text/html

, code: 1)
Anthony Pero’s picture

If a comment is referencing a step that no longer has the same number, you can view an old copy of the document. Make not eof the date of the comment, then click "revisions" at the top of the page. Choose the date that precedes the comment.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

Anthony Pero’s picture

I've created a new documentation page for Drush 6 and 7 via Composer here.

Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/

UrsulaAntares’s picture

This is the best written set of instructions I've seen. Thanks for being so thorough. Worked like a charm, AND I didn't founder between steps to try and match my experience to the description. Useful clues for n00bs, too, that I wish I'd seen years ago.