this is what i get on a hostgator site.

CommentFileSizeAuthor
#2 sapi.patch704 bytesfgm

Comments

geek-merlin’s picture

php_sapi_name() gives 'cgi-fcgi' in this case.
see also #236545: 1and1 and drush.php - Fails CLI test wen using cgi php
i extended steven merrills patch like this and it works for me.

sorry i'm on vacation ;-) and cant roll a patch

in drush.php:38 replace

function drush_verify_cli() {
  if (php_sapi_name() == 'cgi') {
    return (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0);
  }
 
  return (php_sapi_name() == 'cli');
}

with

function drush_verify_cli() {
  return (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0));
}
fgm’s picture

Status: Active » Needs review
StatusFileSize
new704 bytes

Here is the patch.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Seems reasonable. Any comments?

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

Committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

seanr’s picture

Status: Closed (fixed) » Active

Still doesn't work for me. Fresh checkout from head and I'm still getting the error.

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)
seanr’s picture

FWIW, my ISP is looking into it.

anarcat’s picture

Category: bug » support

I think this is not a bug with drush per se. You should have a CLI version of PHP installed or drush will not work, simply. CGIs versions are different and unsupported.

ampersat’s picture

I was able to fix my copy of drush by changing the case of "argc" to ARGC as in:

function drush_verify_cli() {
  return (php_sapi_name() == 'cli' || (is_numeric($_SERVER['ARGC']) && $_SERVER['ARGC'] > 0));
}
ampersat’s picture

Spoke too soon. I was tweaking other code and forgot that I had explicitly set ARGC to a positive value. Even so, when I dump $_SERVER, ARGC is capitalized if it shows up at all. The problem I'm getting is that it seems to be completely ignoring the command line options no matter what I do.

greg.1.anderson’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Presume this turned out to not be a drush issue. Please reopen with more information if needed.

thinkyhead’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

On GoDaddy Linux shared servers, the PHP command-line installation is in /usr/local/php5. So to get Drush to work properly on these servers, it's easiest to just create an 'alias' for drush. If you have Drush installed in your home folder, for example, you can just add this line to your .bash_profile file:

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

(Adjust for your particular install location.) To complete the process, log out. Next time you log into your site via SSH you'll be able to use drush.

greg.1.anderson’s picture

Component: Code » PM (dl, en, up ...)
Issue tags: +drush, +Godaddy

Don't forget to add --php=/usr/local/php5/bin/php to that alias.

thinkyhead’s picture

Yep, the extra flag is needed! I've edited the entry above to show the proper alias.

Ryanbach’s picture

Status: Closed (fixed) » Needs work

I still have an issue with the drush updb command. It does not completely finish because of the error below:

drush updb
The following updates are pending:

colorbox module :
  7001 -   Delete the unused colorbox_login_form variabel.

Do you wish to run all pending updates? (y/n): y
The command could not be executed successfully (returned:            [error]
Content-type: text/html

drush is designed to run via the command line., code: <em
class="placeholder">0</em>)
Finished performing updates.
greg.1.anderson’s picture

Status: Needs work » Postponed (maintainer needs more info)

Drush is not using the same php when it calls itself as it is when you run drush from the command line. This is sometimes seen when you are running drush via an alias and your PATH is not right, or occasionally on some hosts with strange security models (e.g. GoDaddy). In general, you should make sure that the correct PHP is on your PATH, and that the 'drush' command is on your PATH and is not an alias.

If you must use an alias, you must specify a correct --php option that specifies the path to php and any PHP options that you need.

owen barton’s picture

Status: Closed (fixed) » Closed (cannot reproduce)
Vincent.R’s picture

Hey,thinkyhead,
I use the godaddy hosting .why can't find the .bashrc or .bash_history?Could you tell me where is it?I can find some other files with the "."prefix but those two

malcomio’s picture

I was struggling to get drush working on heart internet shared hosting, until I found these instructions:
http://www.johnzavocki.com/blog/setting-ssh-drush-go-daddy-shared-hostin...

On heart internet the key was to add this alias:

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

thinkyhead’s picture

If .bashrc doesn't exist, you can make it with touch ~/.bashrc ... Personally I've moved to Hostgator since then.