"fwrite(): supplied argument is not a valid stream resource"
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.