"fwrite(): supplied argument is not a valid stream resource" drush throws an error


  "Notice:  Use of undefined constant STDERR - assumed 'STDERR'
  in /kunden/192766_10587/bin/drush/includes/drush.inc on line
  1668  Warning:  fwrite(): supplied argument
  is not a valid stream resource in
  /kunden/192766_10587/bin/drush/includes/output.inc on line
  34


What I did is the following. (I followed the instruction from the README.)


Cloned drush

git clone --branch 7.x-5.x http://git.drupal.org/project/drush.git

Wrote into the ~/.bashrc

export PATH="$PATH:~/bin/drush:/usr/local/bin"
alias drush=~/bin/drush/drush.php

Refreshed the bashrc

source ~/.bashrc

Set the 'drush' command executable:

 chmod u+x /path/to/drush/drush



Drush is working but it shows errors every time.

What did I do wrong?
You should not run drush.php directly.  It is preferable to define DRUSH_PHP, like this:

export DRUSH_PHP='/usr/local/bin/php'

Then you may continue to use the drush script as usual.  This is documented in the README.