Trying to use stream_set_write_buffer on a local file will always fail according to this note from 2003.
http://grokbase.com/t/php/php-internals/0351gp6xtn/stream-set-write-buffer-does-not-work
Example:
$fp = fopen("localfile.txt", "w");
if (stream_set_write_buffer($fp, 0) !== 0) {
// changing the buffering failed is always true on local files
}