cli test fails: "drush.php is designed to run via the command line"

aexl_konzepto.net - March 25, 2009 - 16:29
Project:Drush
Version:All-Versions-HEAD
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

this is what i get on a hostgator site.

#1

aexl_konzepto.net - March 25, 2009 - 16:38

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));
}

#2

fgm - March 29, 2009 - 18:06
Status:active» needs review

Here is the patch.

AttachmentSize
sapi.patch 704 bytes

#3

moshe weitzman - April 14, 2009 - 15:29
Status:needs review» reviewed & tested by the community

Seems reasonable. Any comments?

#4

moshe weitzman - April 16, 2009 - 00:37
Status:reviewed & tested by the community» fixed

Committed

#5

System Message - April 30, 2009 - 00:40
Status:fixed» closed

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

#6

seanr - May 9, 2009 - 20:47
Status:closed» active

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

#7

moshe weitzman - May 11, 2009 - 13:04
Status:active» postponed (maintainer needs more info)

#8

seanr - May 11, 2009 - 19:34

FWIW, my ISP is looking into it.

#9

anarcat - May 12, 2009 - 17:37
Category:bug report» support request

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.

#10

bounsy - July 3, 2009 - 14:33

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));
}

#11

bounsy - July 3, 2009 - 14:40

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.

 
 

Drupal is a registered trademark of Dries Buytaert.