I had a little trouble installing and using drush on 1and1, and I wanted to post back the solution that worked for me. It's taken right from drush installation notes, but like all things opensource, it's good to spread the SEO to specifically 1&1 hosting which defaults php interpreter to php4. Drush needs php5.
Per the instructions, just force php5 by creating a .profile (you probably don't have one yet) in your home directory that contains:
alias drush='/usr/local/bin/php5 ~/drush/drush.php'
export COLUMNS
In this case, my drush is installed under /*/*/*/*/htdocs/[drush]
Just like the README.txt says, you'll need to log back in (via ssh) to reread .profile and let this alias become active.
Hope this helps!
-Bronius
Comments
holy... - they are still
holy... - they are still defaulting to php4? Wow... Awesomeness!
Remember to make sure to use
Remember to make sure to use the full absolute path, which is some long string of stuff if you are using 1and1 shared hosting. If you need to figure out what that is, google "find my absolute path" and you're sure to find some code that might help.
Also, you'll want to add the line 'export COLUMS' after the alias. Per the drush readme:
Ok good call (and I've added
Ok good call (and I've added it to my own .profile).
For the record, I am not on 1&1-- it's a client's host. I just felt unclean without clearing that up.
--
http://drupaltees.com
80s themed Drupal T-Shirts
Also check out the "drush" script
Note that when the "drush" script invokes drush.php, it also includes the --php option to specify where your php is located. This is really important if you're going to use any of the drush features that cause drush to call itself (e.g. pm-update).
alias drush='/usr/local/bin/php5 ~/drush/drush.php --php=/usr/local/bin/php5'
Yeah, this should be in the installation notes...
This is all I needed to do
Creating the alias is all I needed to do, ie no need for the profile file.
Are we there yet?
Thanks for you input. I am getting closer but not quite there. I put the alias drush='/usr/local/bin/php5 ~/drush/drush.php' and export COLUMNS in a .profile as you suggested and I no longer get the php too old message. What I now see is;
Status: 404 Not Found
X-Powered-By: PHP/5.2.13
Content-type: text/html
No input file specified.
I even tried putting the path from pwd inplace of the "~" and received the same results.
I even put drush in ~/drush/ to match your example. The one addition thing I tried was to add execute permission to drush/drush and all *.php I could find (six of them).
Thanks,
Jon
Fwiw, I didn't have to set
Fwiw, I didn't have to set execution permissions on this 1and1.com shared host account.
Note that I derived ~/drush by downloading the drush tgz and extracting in the htdocs (or ~) folder directly. I think you're on the right path but have maybe extracted elsewhere. I put my installation here because it was outside the site root, and I didn't have write access to anything just above that folder (to my knowledge).
--
http://drupaltees.com
80s themed Drupal T-Shirts
we're there
Thanks all for your input. What finally worked for me was to put the crowning touches posted by greg.1.anderson (--php=/usr/local/bin/php5'). I had been testing my effort by just typing drush or drush help. It is curious why your install worked without it but not curious enough for me to spin my wheels figuring it out. Beside, with my bash and drupal knowledge, I don't get much traction.
Thanks again for your help.
Jon
because I'm a hack
Ah! Maybe it's due to my remnant earlier attempt wherein I modified ./drush/drush toward the bottom:
It used to be:
HAhahaha (no seriously)
--
http://drupaltees.com
80s themed Drupal T-Shirts
add -q to php cli suppress X-Powered By output headers
Fyi, I've updated this 1and1 client's .profile alias to:
alias drush='/usr/local/bin/php5 -q ~/drush/drush.php'
in order to suppress the
per #923654: drush outputs http headers when used from the command line
--
http://drupaltees.com
80s themed Drupal T-Shirts
Any other tips?
On 1and1.com server, I've done everything you did in the .profile file, and logged out and back in. I also made sure the drush file is executable, but I still get
here's my .profile file (actual pathname redacted):
Interesting... the 'no input
Interesting... the 'no input file specified' error might mean that
should be
...but when I change that, it just outputs the content of the drush script...
Figured it out
Somehow my drush.php (and a number of other files) were not actually copied over onto my server. Once the drush.php file was there, it all worked :)
Hooray for descriptive error messages!
Note that you probably also
Note that you probably also want extra quoting around your --php arg.
alias drush='/usr/local/bin/php5 -q -d memory_limit=80M /*/*/*/*/htdocs/bin/drush/drush.php --php="/usr/local/bin/php5 -q -d"'
Didn't try that, but it looks right.
If you upgrade to drush-5.x, then you can just set the DRUSH_PHP environment variable to point at the php you'd like to use. Don't put any php commandline options in DRUSH_PHP -- it should contain only the full path to php. Put php options into $HOME/.drush/drush.ini. See
drush topic docs-ini-files
for more information.Remote drush
While all the above is very helpful for getting drush to work when you have the console open on your 1and1 account, I had some issues when running drush remotely, it was ignoring .profile so I managed to add a bit to my aliases.drush.php file, the key line here is %drush-script I hope this of some help.
Drush cannot be used with 1&1 shared hosting
Spoke with 1&1 for awhile. They stated that Drush cannot be used with 1&1 shared hosting.
You need a dedicated server package.
I would like to reply that
I would like to reply that while 1and1 may not officially support the use of drush on their shared severs, it does work with the above method. At least it works as of this posting.
1and1 Drush Install not working =\
aside from getting the "permission denied" message...
I get this error
X-Powered-By: PHP/4.4.9
Content-type: text/html
Parse error: syntax error, unexpected '{' in /*/*/*/*/*/drush/includes/environment.inc on line 518
I have the Business package using Linux and PHP5 is installed
my head is about to burst... lol
1and1 Drush Install not working =\
Drush "kind of" works for me (Developer package and 1and1) but I think I figured out why it does not work correctly.
I don't believe that 1and1 has the command line php installed. I have php5 on my Ubuntu workstation and I never see these headers when executing php from the command line:
X-Powered-By: PHP/5.2.17
Content-type: test/html
Also the output never has tags like or
in it. That's a sign (to me) that it's not the command line PHP.
Shopping over at Linode.com now.
Good luck.
Eric Lucas
I get this error, pretty much
I get this error, pretty much the same as the last poster but my perms are not denied.
X-Powered-By: PHP/4.4.9
Content-type: text/html
Parse error: syntax error, unexpected '{' in /*/*/*/*/*/drush/includes/environment.inc on line 518
I have the Business package using Linux and PHP5 is installed
Help would be awesome, I'd rather update with drush than otherwise. Thanks!
Got mine working
mine is a business account (1and1 hosting), and after several attempts I just got mine working.
I follow this intruction: http://networkedblogs.com/E7og2
========
Then you will have to add this to the top of the drush/drush.php file after the first < ?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'));
}
=====
and here is my .profile content:
alias drush='/usr/local/bin/php5 -q /kunden/homepages/*/*/htdocs/drush/drush.php --php=/usr/local/bin/php5'
export COLUMNS
Hope this help
Using PHP 5.4 onwards
On 1and1 I couldn't enable a module that wanted PHP version 5.3 at least. By trial and a lot of error, I found that you need to use an alias for php6 on 1and1. (Try 'which php5' etc.)
The following line in my .bash_profile gives me PHP 5.4 for Drush (notice the slightly different path):
alias drush='/usr/bin/php6 -q /kunden/homepages/*/*/htdocs/drush/drush.php --php=/usr/bin/php6'
Thanks, PedroKTFC using PHP6
Thanks, PedroKTFC using PHP6 for drush did the trick for me. ... Find it odd that 1and1 global php for my domain is set to 5.4 but it reports as 5.2.17 on 'php --version'
thanks, this made my day!
thanks, this made my day! trial and error
I also made a blogpost about
I also made a blogpost about it...
updated it today...
https://stevenschulz.net/blog/drush-auf-1und1-server-installieren-mit-composer
This works for me
Thanks for the above post, modded it a bit for my situation and it works! Only difference is in ~/.bashrc I have
Thanks again!
All of the advice on this
All of the advice on this page for aliasing drush to call php directly is a few years old. Nowadays, you are better off setting the DRUSH_PHP environment variable and calling the 'drush' script directly.