I ran drush cc all and it produced the following output:

X-Powered-By: PHP/5.2.3
Set-Cookie: SESSc21f969b5f03d33d43e04f8f136e7682=540794e3bf793531b8de7288ff4f4d3f; expires=Thu, 15 Dec 2011 21:36:40 GMT; path=/
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Tue, 22 Nov 2011 18:03:20 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Content-Type: text/html; charset=utf-8

<br />
<b>Warning</b>:  fwrite(): supplied argument is not a valid stream resource in <b>xxx/.drush/drush/includes/drush.inc</b> on line <b>576</b><br />
<br />
<b>Warning</b>:  fwrite(): supplied argument is not a valid stream resource in <b>xxx/.drush/drush/includes/drush.inc</b> on line <b>576</b><br />

Also a drush status produces the following output:

drush status
X-Powered-By: PHP/5.2.3
Content-type: text/html

 Drush version         :  4.5 
 Drush configuration   :      
 Drush alias files     :  

Environment:

Red Hat Enterprise Linux ES release 4 (Nahant Update 9)
PHP 5.2 (as CGI)

Seems like the headers are being outputted into the commands.

Comments

chrisjlee’s picture

Issue summary: View changes

Reorganize Page

greg.1.anderson’s picture

Status: Active » Fixed

Drush does not support php-cgi; run it under php-cli.

Status: Fixed » Closed (fixed)

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

koppie’s picture

I just wandered onto this thread and I suspect others will too. Greg was right, you need to use PHP CLI, but he didn't say how to do it. For anyone else who was as confused as me, this is what you need to put in .bash-profile (or .bashrc):

alias drush='php /home/<username>/public_html/drush/drush.php'
alias php='/usr/bin/php-cli'
chrisjlee’s picture

Ah thanks @koppie i didn't know how to do that either.

greg.1.anderson’s picture

Status: Closed (fixed) » Fixed

#3 was fine for drush-2 and drush-3, but is not recommended for drush-4 or later. You should always run the drush script to run current versions of Drush.

drush-4 and later will respect the environment variable DRUSH_PHP, and will use the php executable that it represents. Therefore, you should instead put something like the following in our .bash-profile or .bashrc:

export DRUSH_PHP=/usr/bin/php-cli

Read man bash, or search google if you need information on configuring your shell.

greg.1.anderson’s picture

Title: fwrite(): supplied argument is not a valid stream resource in <b>/xxx/.drush/drush/includes/drush.inc » Tell Drush to run php-cli instead of php-cgi [fwrite(): supplied argument is not a valid stream resource]

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

fix page