Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
running Drupal 6.14 on GoDaddy hosting with php 5.2.8.
I have a stuck cron job which I don't know how to kill (I've deleted cron_semaphore and cron_last_run several times).
Thought drush might help.
Installed drush but when I run $ drush I get
Your PHP installation is too old. Drush requires at least PHP 5.2.0
Anybody?
Comments
Comment #1
pescetti CreditAttribution: pescetti commentedIt may happen, especially on shared hosting, that the PHP module for Apache (used to serve pages) and the command-line PHP are two different versions.
Do you still see PHP 5.2.8 if you run the following?
$ php --version
Comment #2
austintnacious CreditAttribution: austintnacious commentedThanks!
At the command line php version is only 4.4.9.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedI added a bit more info in the error msg - 'Your command line PHP installation is too old. Drush requires at least PHP ' . DRUSH_MINIMUM_PHP
Comment #4
bcruiksh CreditAttribution: bcruiksh commentedThe server I'm using runs both php4 and php5, but it defaults to 4 at the command line. How can I get drush to use php5?
At the prompt "php5 --version" returns PHP 5.2.6
Thanks.
Comment #5
dman CreditAttribution: dman commentedThis is common on many shared/hosted servers.
Look at the results of
If you had root control of the server, you can fix it with symlinks. Unlikely.
I tried to
alias php=php5
.. Which did work on the commandline and started giving me good results when I wentphp --version
but drush did something wacky (with 'env') to bust that quick fix.... so instead I just edited the
drush
shell file itself and replaced the last few lines with an EXPLICIT call to php5Not a full fix, but got me to the point I could bootstrap my deployment on a remote, hosted site for someone.
There are probably many other shell tricks to solve this in many ways. This hack just worked, wish there was some cleaner way.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedthe readme recommends that you make a bash alias to drush.php. in your case the alias would look like:
drush = php5 /path/to/drush.php
Comment #7
bcruiksh CreditAttribution: bcruiksh commentedThanks for the help. #6 seems to have worked.
Comment #8
bdornbush CreditAttribution: bdornbush commented#6 got me close but not quite.
There is a file in my home directory called .bash_profile There was no file called .profile or .bash_aliases There is also a file called .bashrc
I put the following in both .bash_profile and .bashrc:
alias drush='/usr/local/php5/bin/php /home/fumcsr/drush/drush'
I got the /usr/local/php5/bin/php from my hosting service info
I also put
export COLUMNS
in my .bash_profile file
I logged out of Putty and back in. When I type DRUSH and nothing else or anything else,
for example:
DRUSH
DRUSH DL TAC_LITE
DRUSH HELP
DRUSH CRON
I get
What am I doing wrong?
Comment #9
bdornbush CreditAttribution: bdornbush commentedre #8
I put the following in both my .bash_profile and .bashrc files (this is probably not necessary or even right, but it worked):
export COLUMNS
alias drush='/usr/local/php5/bin/php /home/fumcsr/drush/drush.php'
alias php='/usr/local/php5/bin/php'
Note that the key difference from above is the ".php" at the end of the alias drush. In the readme file, there is one example with the .php, and one without. I guess I just got them mixed up.
I also ran
dos2unix .bash_profile
dos2unix .bashrc
Again, I don't know if this was needed, but I have had to do it before, as I edit on a Windows PC and upload using WinSCP (an SFTP client).
Now all works properly.
Perhaps someone who know more about Linux and Bash can comment about the need for .bash_profile vs. .bashrc, and using dos2unix.
Comment #10
dman CreditAttribution: dman commentedFYI
The need for dos2unix depends on your choice of text editor - not the upload method.
If you use something (almost anything) less brain-dead than windows 'notepad', then the newlines should be retained in their original format - either 'dos' or 'unix' depending. Which format you start with depends on the editors preference.
Most of these text editors will also have an option to switch for you - often in the 'file properties' menu.
Comment #11
bdornbush CreditAttribution: bdornbush commentedI set up another site's drush, so I put the 3 lines shown in #9 into .bash_profile, and didn't run dos2unix (I used EditPad Lite as the editor) and it worked fine.
Comment #12
tars16 CreditAttribution: tars16 commentedI'm having an issue with this as well. I've got drush working with the following 2 methods:
from the command line I create an alias
alias drush='/usr/local/php5/bin/php ~/private/drush/drush.php'
in the .bash_profile I've added the following lines as suggested above:
Drush help lists all the commands I need, but when I run drush up xmlsitemap (or any module) I get the following error:
The module code gets updated as refreshing the status report shows it was successful.
Any idea whats going on here?
This particular site is running on Drupal 5.18, update_status module has been upgraded to 2.5 (also ran into an issue there) and it is hosted on Dreamhost.
Comment #13
fuzzy_texan CreditAttribution: fuzzy_texan commentedHaving the same problem as #12 on my shared hosting. A lot works, but several commands still seem to switch out to another shell / session which is causing the wrong PHP version errors.
Comment #14
bdornbush CreditAttribution: bdornbush commentedI am having the same problem as #12. I just saw it when I tried to run DRUSH UP. DRUSH DL works fine. I am also using DreamHost, with the three lines I noted in #9.
Drupal was updated to the latest 6 release so everything seems OK.
What am I missing if drush_pm_post_pm_update does not run?
Comment #15
andywalters CreditAttribution: andywalters commentedFYI, #6 worked for me as well.
Comment #16
benklocek CreditAttribution: benklocek commentedI'm using MediaTemple Grid service and have everything running fine using those aliases *if I'm ssh'ed in*. (MT uses php4 as the default, so I've aliased drush to use php5.)
If I try to run "$ drush @rjlive en module" from my local machine, I get the "Your command line PHP installation is too old" error.
Is there a way to make drush use the .bashrc or .bash_profile when using a remote alias?
Comment #17
dman CreditAttribution: dman commented@benklocek - I know what you mean.
See the README
Use 'which php' when ssh-ed in to find the correct php path.
Forcing the non-shell login to see your normal PATH and .bashrc can be tricky when you have limited control of the system.
... hm, actually it won't pick up your .aliases file either, so that may not work.
Um, maybe create a small shell script that invokes drush, then set that as
'path-aliases' => [ '%drush-script' => '/path/to/drush/drush', ]
in your site-aliases settings.... messy, there are other ways to correctly get non-interactive shells to read your .profile, but I can't recall them right now.
Comment #18
arton CreditAttribution: arton commentedThought I'd include this link to change the command line php version for mediatemple users. Fixed the issue for me.
http://wiki.mediatemple.net/w/Set_specific_PHP_version_for_command_line_on_(gs)_Grid-Service
Comment #19
Alexander Allen CreditAttribution: Alexander Allen commentedIn my case even when trying all the above recommendations I was still getting the same error message. I was using Drush with remote aliases, and putting
alias php='/user/local/php5/bin/php'
in .bashrc wasn't doing the trick. I made sure the PATH variable in .bashrc was pointing to PHP5 as well.When running
$ php -v
bash returned PHP 5.2.11.However when executing the
$ which -a php
command I would get two versions of PHP:While using Drush with remote aliases (i.e.
drush @myremotealias info
), Drush would always find the first PHP location, which is PHP version 4.To fix this (using my root login), I had to go to /usr/local/bin and move PHP4 to another location (/usr/local/php4/bin).
This removed PHP4 from the PATH's variable scope, and when running
$which php
I would only get the PHP5 version. After that Drush began using the correct PHP 5 version (while still using remote aliases).Also, when placing
export COLUMNS
in .bashrc, log out and log back in. If when you log back in and run the command$ echo COLUMNS
you getCOLUMNS
as a response, you should consider puttingexport COLUMNS=80
in .bashrc instead.And for all the questions about the difference between .bash_profile and .bashrc, bashrc stands for bash-remote-console. Meaning when you do a non-interactive remote login, whatever you put in .bashrc is what will get loaded (instead of .profile or .bash_profile).
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm a bit late, but in case someone has the same problem again:
drush (v4+) tries to find the most appropriate php version. And at first it checks the DRUSH_PHP enviromnment variable. If you set it in your
~.bashrc
likethen drush uses this version of php instead of `which php`.
Comment #21
lord_of_freaks CreditAttribution: lord_of_freaks commentedTry this .. works for me
http://mytwocents.karit.geek.nz/2010/03/path-to-php5-cli-on-godaddy.html
The problem is the path try with: "'/usr/local/php5/bin/php"
.bashrc example