Drush 2 just came out. It's awesome. (http://drupal.org/project/drush) After installing it on my DreamHost server, I got the error below. I just thought I'd post the solution, in case anyone out there runs into the same problem...

Here's the error I was getting:

> $ drush
> Your PHP installation is too old. Drush requires at least PHP 5.2.0

Here's the solution:

The default version of PHP on the server is PHP4. This is because the
server uses the PATH settings rather than the Apache to specify which
version is run. The path for PHP4 /usr/local/bin/php comes before the
PHP5 path /usr/local/php5/bin/php so it always runs first when you type
php from the shell.

To run PHP5 from the shell you need to specify the entire path:

/usr/local/php5/bin/php --version

The drush file is auto-detecting the default php4 version. So you will
need to modify the drush file. Try changing this line:

/usr/bin/env php $SCRIPT_PATH "$@"

To this:

/usr/bin/env /usr/local/php5/bin/php $SCRIPT_PATH "$@"

Comments

nadavoid’s picture

If you don't want to edit any drush files, and rather just customize the environment variables at dreamhost, I found the following to work for me:

At the bottom of your .bash_profile file, add this line:
export PATH=/usr/local/php5/bin/:$PATH

This is the other line I added, so I can have easy access to the "drush" command:
alias drush='/path/to/drush/drush'

cfont’s picture

this was the best advice for me. totally solved all my problems. thank you very much.

joshmiller’s picture

Thanks!

gr33nman’s picture

Thanks

anthonyalbertyn’s picture

I followed these instructions but received a permission denied when trying to execute drush.
I did this to fix the problem: chmod u+x drush/drush

anthonyalbertyn’s picture

Fire up your mac terminal
Connect via ssh to dreamhost site: ssh username@yourwebsite.com
Enter your password when prompted
Then type: nano .bash_profile
A text editor will then open the bash profile
User your arrow key to navigate to the bottom of the text file
Then on separate lines type in:
export PATH=/usr/local/php5/bin/:$PATH
alias drush='/path/to/drush/drush'
Then press: ctrl+x
Then type: Y
Then press enter

Additional steps to make Drush usable
In your terminal, type exit
Then login again via ssh
Then type chmod u+x drush/drush

Then to test if drush is working, type: drush
To see a list of drush help commands, type: drush help

Happy Drushing!

anthonyalbertyn’s picture

Had to do a new drush install on Dreamhost this morning and this worked for me:
1. Download drush from drupal.org/project/drush
2. Used SFTP to upload drush folder to home directory in Dreamhost
3. Login to Dreamhost via terminal/shell. ssh username@yourwebsite.com then enter password
4. chmod u+x drush
5. nano .bash_profile
6. scroll down to bottom of text file and type: alias drush='~/drush/drush'
7. ctrl+x then type Y to save and press enter
8. close terminal/ssh connection and then log in again
9. type drush help and pres enter
10. you should now have access to drush

Note: I did not need this line: export PATH=/usr/local/php5/bin/:$PATH

anthonyalbertyn’s picture

step 4 above should be:
chmod u+x drush/drush

haaid’s picture

your explanation helped me having drush up and running on dreamhost in no time.
thank you.

peleust’s picture

This is the other line I added, so I can have easy access to the "drush" command:
alias drush='/path/to/drush/drush'

That worked for me too!

Jason Ruyle’s picture

Thanks for the info.
I ended up changing both the cli path as well.

------------------------------
i do stuff

nadavoid’s picture

How did you do that? Could you give examples of the lines you added, and what file you added them to?

dangswiss’s picture

..that totally did the trick for me :-)

-the first one, i mean

miller.t.chris@gmail.com’s picture

Worked perfectly on my Dreamhost server! Thanks so much!