I don´t know how to use drush nor the command line, so I´ve started to read some tutorials, and watch some videos. I´ve installed the drush windows installer, because I have windows.

The thing is that all examples I´ve read so far, start with localhost. What if I have my devel installation in a shared hosting or a VPS, in the cloud? How to access that?

Using my ftp program, I access it using hostname ftp.mysite.com the username and the password to that account. How may I do that with the command line?

Thanks!

  • These answers are all good, but your hosting service should have some documentation about how to SSH into your server. And, by the way, you don't use drush at all in simply accessing your site via terminal. – cdmo Mar 1 '13 at 12:41
  • I know that, that´s why I´m asking what should I do after I access my site via terminal... – Rosamunda Mar 1 '13 at 15:59
up vote 3 down vote accepted

If I understand correctly, you want to just use Drush on remote site. You don't need to do anything with aliases.drushrc.php for it. You need to have access to SSH on your remote server, there are many tutorials on the net how to use SSH. You need to upload Drush through SSH on server - create a folder, like "programs" (it would be nice if it would be not accessible through http) and put there drush-7.x-5.8.tar.gz . Untar it with command:

tar -zxvf drush-7.x-5.8.tar.gz

Next: Edit your .bash_profile file located in your home directory or create it (you can use command "nano .bash_profile" in your home directory), and put there:

export DRUSH_PHP=[absolute path to your php]/bin/php-cli

For example: "export DRUSH_PHP=/usr/local/php54/bin/php-cli" - you can check this path in output of your phpinfo().

Also add this line:

PATH=~/programs/drush:${PATH}

After this if you are logged on your remote server through SSH, you can go to directory of your Drupal site and use command "drush status" to check if everything works ok. Voila - you have drush installed on your server.

  • Thanks for your reply! After doing that I get this message when I try to check if it´s installed: -bash: drush: command not found (I´ve checked and my path is /usr/local/lib/php/bin/php-cli) – Rosamunda Feb 28 '13 at 20:12
  • Try to logout, changes will take place after you log in again. This error means that your path in "PATH=~/programs/drush:${PATH}" is wrong, are you sure that you have "programs/drush" in your home directory? Also - "drush" in this path is a directory of your extracted drush, and not drush itself ("executable"). – Łukasz Zaroda Feb 28 '13 at 22:40
  1. go into your drush folder
  2. Copy the file examples/example.aliases.drushrc.php to root of your drush folder and rename it to aliases.drushrc.php
  3. Read the comments in that file and this slideshare
  4. create your aliases for both the local site and development site (on shared or vps)
  5. make sure you have a proper ssh connection setup to your remote server
  • Thaks! I´ve done all that, but what should I do next? I´ve tried opening the "Drush Command Prompt" in my windows pc, and doing drush @myaliasname status will not do, how do I connect from there? Thanks again! – Rosamunda Feb 28 '13 at 17:47
  • The slideshare says that I should "Just "cd" in the site´s directory and issue Drush commands". But the windows installer is in my pc... maybe is a very silly question, but what should I do next? Thanks again. – Rosamunda Feb 28 '13 at 17:52

To access a remote server using the command line, you usually use ssh.

For windows, you can use a tool called PuTTY - there's a tutorial here: http://support.suso.com/supki/SSH_Tutorial_for_Windows

See this post for Drupal on shared hosting accounts: Installing Older Versions of Drush on Shared Hosting Accounts. Here is an excerpt about it:

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.

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – mpdonadio Mar 6 '14 at 1:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.