PHP Mapscript and WMS Server

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Mon Sep 4 15:00:48 PDT 2006


Nicole,

   There at least one way that works when outputting the result of a 
GetMap request with a png format. The 2nd example on the 
http://mapserver.gis.umn.edu/docs/howto/wxs_mapscript/#php-example.
<?php

dl("php_mapscript_4.10.0.dll");

$request = ms_newowsrequestobj();

$request->loadparams();

ms_ioinstallstdouttobuffer();

$oMap = ms_newMapobj("../../service/wms.map");

$oMap->owsdispatch($request);

$contenttype = ms_iostripstdoutbuffercontenttype();

if ($contenttype == 'image/png')
    header('Content-type: image/png');

ms_iogetStdoutBufferBytes();

ms_ioresethandlers();

?>

Could you try this ?

Nicol Hermann wrote:
> Bart,
> thanks for your mail.
> As i mentioned in my first posting i have tried to set the content-type
> but this did not change the behaviour.
> Frank, is it possible that there's is some output before the
> content-type is set so that the php assume that text content will
> follow?
> 
> Nicol
> 
> Am Montag, den 04.09.2006, 20:59 +0200 schrieb Bart van den Eijnden
> (OSGIS):
> 
>>You can set the content-type, by using something like:
>>
>>header("Content-type: image/gif");
>>
>>Frank, you can also try to run php with the -q switch from the 
>>command-line to get rid of:
>>
>>Content-type: text/html
>>X-Powered-By: PHP/4.3.8
>>
>>Best regards,
>>Bart
>>
>>Frank Warmerdam schreef:
>>
>>>Nicol Hermann wrote:
>>>
>>>>Frank,
>>>>
>>>>thank you very much for your mail.
>>>>I'm afraid there is still a problem somewhere.
>>>>I checked out the latest cvs release and rerun my test script but the
>>>>"bad lines" at the end are still present. PHP mapscript version is:
>>>>$Id: php_mapscript.c,v 1.259 2006/08/31 15:34:30 assefa Exp $
>>>>Is there's something i could do to further debug this issues?
>>>>
>>>>Maybe an other issue.
>>>>I put together a simple wms server map-file which includes an other wms
>>>>(demis). When i execute my PHP script with
>>>>http://localhost/~nicol/mapserver/dev/wxsGetMapCascading.php?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=Countries&WIDTH=200&HEIGHT=200&FORMAT=image/png&SRS=EPSG:4326&BBOX=5.86629,47.2736,15.0486,55.0583 
>>>>
>>>>the Content-type won't be set correct.
>>>
>>>Nicole,
>>>
>>>I stand corrected.  The problem you are seeing is different than what I
>>>thought was going on.  When I run your php script at the unix commandline
>>>I get the following back:
>>>
>>>Content-type: text/html
>>>X-Powered-By: PHP/4.3.8
>>>
>>>ttt9Content-type: image/png
>>>
>>>?PNG
>>>...
>>>
>>>So the problem seems to be that PHP always emits the text/html content
>>>type.  I don't know how to alter this in PHP, or even if it is possible.
>>>But the problem is related to PHP document processing, not mapserver or
>>>PHP Mapscript itself.
>>>
>>>Best regards,
>>
> 


-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the MapServer-users mailing list