I think it is the newline after the ?>
Are you sure you don't have an extra newline (possibly after some whitespace) at the end of the file?
I guess easiest would be to save the PHP file without newlines, for example by saving the PHP file using command
printf '<?php echo $_SERVER[\047REMOTE_ADDR\047]; ?>' > filename.php
Note that if you edit the file, most editors will add a newline at end for you automatically.