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
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
Here is the patch.
#3
Seems reasonable. Any comments?
#4
Committed
#5
Automatically closed -- issue fixed for 2 weeks with no activity.
#6
Still doesn't work for me. Fresh checkout from head and I'm still getting the error.
#7
#8
FWIW, my ISP is looking into it.
#9
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
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
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.