I have code that generates a Google KML feed on my primary production server that works fine. When I copy it to the secondary production mirror, there’s a newline at the beginning of the file. Everything else works fine. Would anyone happen to know which configuration options could possibly force a newline to be the first character of a file being created?
Code to generate the file:
header('Content-type: application/vnd.google-earth.kml+xml');
header('Content-Disposition: attachment; filename="My KML.kml"');
echo '<?xml version="1.0" encoding="UTF-8"?>\n' .
'<kml xmlns="http://earth.google.com/kml/2.2">\n' .
'(The rest of the KML code)';
Most likely the file is being included from another file which has an extra carriage return at the bottom. Find the file with the extra carriage return and you will find the culprit.