Blanks at the beginning of the output are often caused by newlines behind the closing php tag.
<?php¶
¶
// Some code here¶
¶
?>¶
¶
Anything outside of <?php ?>
as directly seen as output. Therefor, you should never use the closing tag in library files.
For files that contain only PHP code, the closing tag ("?>") is never permitted. It is not required by PHP, and omitting it´ prevents the accidental injection of trailing white space into the response.