for some of my projects, drush works great. others, i get this:

session_start(): Cannot send session cookie - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                               [warning]
session_start(): Cannot send session cache limiter - headers already sent (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                           [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                                          [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                                          [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                                          [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439)                                                                                                                          [warning]
Drush command could not be completed.                                                                                                                                                                                                                   [error]

file permissions are the same, drupal version is the same, etc. any advice?

CommentFileSizeAuthor
#6 debug_drush_headers.txt1.2 KBj0rd

Comments

jrefano’s picture

btw this is for ALL commands. and here's a more full paste using -d

Found command: status [0.018 sec]                                                                                                                                                                                                                       [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.019 sec]                                                                                                                                                                                      [bootstrap]
Initialized Drupal 6.12 root directory at /Users/john/lit [0.026 sec]                                                                                                                                                                               [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.027 sec]                                                                                                                                                                                      [bootstrap]
Initialized Drupal site default at sites/default [0.078 sec]                                                                                                                                                                                               [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.078 sec]                                                                                                                                                                             [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.081 sec]                                                                                                                                                                                  [bootstrap]
Successfully connected to the Drupal database. [0.081 sec]                                                                                                                                                                                              [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.087 sec]                                                                                                                                                                                      [bootstrap]
session_start(): Cannot send session cookie - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439) [0.088 sec]                                                                                                   [warning]
session_start(): Cannot send session cache limiter - headers already sent (output started at /Users/john/drush/includes/drush.inc:439) [0.088 sec]                                                                                               [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439) [0.103 sec]                                                                                                              [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439) [0.103 sec]                                                                                                              [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439) [0.103 sec]                                                                                                              [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/drush/includes/drush.inc:439) [0.104 sec]                                                                                                              [warning]
Drush command could not be completed. [0.187 sec]                                                                                                                                                                                                       [error]
owen barton’s picture

Status: Active » Postponed (maintainer needs more info)

This is caused by one (perhaps more) contrib modules - see http://drupal.org/node/445102#comment-1639598 for an example.

Please try disabling all modules, check it is fixed and then enabling modules one by one until you find the offender.

jrefano’s picture

Status: Postponed (maintainer needs more info) » Active

thanks for your quick response, i will take a look

jrefano’s picture

i thought it was filefield, but it's not. basically, the only time it's working is if i disable all of my contrib modules. i will investigate further at some point.

j0rd’s picture

I have the same issue. Not sure which module it is. Not looking forward to debugging said issue.

Could we capture cookies and headers and toss them away, since I doubt Drush uses them...or is this not in the cards?

It's a shame that other modules are able to break drush.

j0rd’s picture

StatusFileSize
new1.2 KB

I wrote a little script to help those debug your modules. Your milage may vary with this and it has a high possiblity of messing up your systems table, so please make back ups. You have been warned!

It did on the other hand help me find out which module was causing my problems (wretched splash module).

It goes through your enable module under a specific path, disabling them one at a time, running drush and then re-enabling them and moving onto the next module.

llkks’s picture

Good to know that I'm not the only one having this problem.

Does anyone know what to do with the "offender"-module? Is there any use in locating the problem, if I can't relinquish any of my modules?

I'm thankful for every idea to solve this problem....

jrefano’s picture

Priority: Normal » Critical

j0rd, i used your script (anyone trying it please notice a typo, your need to change $path_to_module_dir to $path_to_modules_dir, but i digress)... and for every module that gets toggled, drush still outputs the usual "Drush command could not be completed." That is to say, somehow, it must be a combination of modules causing drush to fail.

At any rate, still having the same error as in my inital post, even after disabling every single module one at a time with j0rd's very helpful script.

Maybe adding a way to get more specific debug information from drush directly would be helpful to fix this issue??

Paste from most recent broken project follows:

$ drush -d status
Found command: status [0.018 sec]                                                                                                                    [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.018 sec]                                                                                   [bootstrap]
Initialized Drupal 6.13 root directory at /Users/john/projects/projectname [0.026 sec]                                                             [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.026 sec]                                                                                   [bootstrap]
Initialized Drupal site default at sites/default [0.071 sec]                                                                                            [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.071 sec]                                                                          [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.075 sec]                                                                               [bootstrap]
Successfully connected to the Drupal database. [0.075 sec]                                                                                           [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.081 sec]                                                                                   [bootstrap]
session_start(): Cannot send session cookie - headers already sent by (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.082 sec][warning]
session_start(): Cannot send session cache limiter - headers already sent (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.082 [warning]
sec]
Cannot modify header information - headers already sent by (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.103 sec]           [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.103 sec]           [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.103 sec]           [warning]
Cannot modify header information - headers already sent by (output started at /Users/john/canary/drush/includes/drush.inc:439) [0.103 sec]           [warning]
Drush command could not be completed. [0.182 sec]   
jrefano’s picture

i determined that my terminal was using the default osx php (/usr/bin/php) instead of the MAMP php (/Applications/MAMP/bin/php5/bin/php). updated my path and now things work as expected. so in my case it wasnt a drush error.

related: http://drupal.org/node/551828#comment-1938434

moshe weitzman’s picture

Status: Active » Closed (fixed)

this is not drush.

ivansf’s picture

Experiencing this problem. I usually run into this after installing a couple of modules on ANY site.

Here's an example after removing ubercart it worked. And it can happen with a lot of modules. I didn't post the output with --debug but it's basically the same error reported.

Gundam:drush_test ivan$ /Applications/MAMP/bin/php5/bin/php /Developer/drush/drush.php status
Drush command could not be completed.                                [error]   
Gundam:drush_test ivan$ rm -rf sites/all/modules/ubercart/
Gundam:drush_test ivan$ /Applications/MAMP/bin/php5/bin/php /Developer/drush/drush.php status
  PHP configuration : /Applications/MAMP/conf/php5/php.ini
  Drupal Root       : /Users/ivan/Sites/www/drush_test
  Drupal version    : 6.14
  Site Path         : sites/default
  Site URI          : http://default
  Database Driver   : mysqli
  Database Hostname : localhost
  Database Username : root
  Database Name     : drush_test
  Database Password : root
  Database          : Connected
  Drupal Bootstrap  : Successful
  Drupal User       : Anonymous
Gundam:drush_test ivan$ 

ivansf’s picture

Status: Closed (fixed) » Active

Here's another test... On my OSX box I've been trying anything to fix it. HEAD version, recommended version, different sites/installations, etc. At every point I get to the same error.

I know this could be cause by a module having a whitespace before the php tag, or incorrectly closing them. It just doesn't justify making drush crash because of this.

Gundam:drush_test ivan$ drush status
  PHP configuration : /Applications/MAMP/conf/php5/php.ini
  Drupal Root       : /Users/ivan/Sites/www/drush_test
  Drupal version    : 6.14
  Site Path         : sites/default
  Site URI          : http://default
  Database Driver   : mysqli
  Database Hostname : localhost
  Database Username : root
  Database Name     : drush_test
  Database Password : root
  Database          : Connected
  Drupal Bootstrap  : Successful
  Drupal User       : Anonymous
Gundam:drush_test ivan$ drush dl ubercart
Project ubercart (6.x-2.0) downloaded to /Users/ivan/Sites/www/drush_test/sites/all/modules/.                     [success]
Gundam:drush_test ivan$ drush status
Drush command could not be completed.                                                                             [error]
Gundam:drush_test ivan$ drush status --debug
Found command: status [0.025 sec]                                                                                 [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.025 sec]                                                [bootstrap]
Initialized Drupal 6.14 root directory at /Users/ivan/Sites/www/drush_test [0.033 sec]                               [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.033 sec]                                                [bootstrap]
Initialized Drupal site default at sites/default [0.052 sec]                                                         [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.052 sec]                                       [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.055 sec]                                            [bootstrap]
Successfully connected to the Drupal database. [0.055 sec]                                                        [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.063 sec]                                                [bootstrap]
session_start(): Cannot send session cookie - headers already sent by (output started at                          [warning]
/Developer/drush/includes/drush.inc:482) [0.064 sec]
session_start(): Cannot send session cache limiter - headers already sent (output started at                      [warning]
/Developer/drush/includes/drush.inc:482) [0.064 sec]
Cannot modify header information - headers already sent by (output started at                                     [warning]
/Developer/drush/includes/drush.inc:482) [0.08 sec]
Cannot modify header information - headers already sent by (output started at                                     [warning]
/Developer/drush/includes/drush.inc:482) [0.08 sec]
Cannot modify header information - headers already sent by (output started at                                     [warning]
/Developer/drush/includes/drush.inc:482) [0.08 sec]
Cannot modify header information - headers already sent by (output started at                                     [warning]
/Developer/drush/includes/drush.inc:482) [0.08 sec]
Drush command could not be completed. [0.163 sec]                                                                 [error]
Gundam:drush_test ivan$ 
ivansf’s picture

Status: Active » Closed (fixed)

For some reason when I run php installed from MAMP it doesn't use the same php.ini file. It was running with 8M but MAMP was configured with 128

In the end I had a PHP issue at my computer.

Try running this:

$ php -i | grep memory

My drupal installation reports 128M but the php CLI reports:

memory_limit => 8M => 8M

weird, but editing /Applications/MAMP/conf/php5/php.ini fixed the issue obviously.

finn lewis’s picture

I had this exact issue, and increasing the memory in editing /Applications/MAMP/conf/php5/php.ini solved it for me too.

It was doubly annoying as drush would work on a fresh install of D6, not being that hungry for memory, then would stop working after installing a few modules.

Thanks for the post ivansf!

Mixologic’s picture

Just want to add a comment here..

If you are using MAMP PRO, it configures a completely different php.ini file than the one that is normally found in your path on the command line.

I had to hunt all over to find it, but its buried under /Library/Application Support/appsolute/MAMP PRO/conf

This is for MAMP PRO 1.8.2

I had an older version of MAMP PRO 1.7.? and it was under
/Library/Application Support/living-e/MAMP PRO/conf

I simply copied it to here:

/Applications/MAMP/conf/php5/php.ini

and changed my path to look for php in /Applications/MAMP/conf/php5/bin

And voila drush started working again!

msumme’s picture

I'm having the same problem, and I only have 64M of memory for a site I'm maintaining...

Is that REALLY not enough to run drush? That seems a little ridiculous....