Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Thursday, July 30, 2009

white space fore php tag

While a blank line before the <?php start tag may look innocent, when processed by PHP, it will turn into an echo statement printing out a blank line.

If working with web service wrapper scripts from mapserver this could be a disaster resulting in some strange behaviours like:

1) After $request->loadparams(); the script will send you an empty file as a reply
2) If the $request has uses setparameters, all the outputs will be dumped to the browser window, for example a WMS GetMap request will be a binary string in the browser window.
3) The ms_iogetStdoutBufferBytes(); will return nothing if you want to save the image locally.
4) Output with Warning: Cannot modify header information - headers already sent by

These symptoms are caused by the existence of an open buffer cause by the blank line, at the begining of the php programming.

Labels: , ,