[mapserver-users] Phpmapscript doesn't work with Postgis

Juanma M. R. juanma.mr at gmail.com
Mon Mar 30 06:25:05 EDT 2009


Hi list,

We are migrating our servers to a new server based on Centos and we are
suffering problems with the use of phpmapscript.

Postgis is working correctly when accessing from php but it fails when
executing the code bellow (our script is more complicated but I have removed
the other issues just to check what is failling and aboid side effect from
our code). The problem is that mapserver as cgi works correctly with the
same map file and the same layer and mapscript is compiled at the same time
than mapserver with postgis support (--with-php in the mapserver configure
options). The apache logs shows an Unexpected process ending with
Segmentation fault (11) error. The PostGIS log just sais that the connection
was broken unexpected by the client but doesn't give more details.

If anyone have any sugestion to follow up the testing and debugging, any
other way to try to find the problem or at least more details about what
could be failling, because we have no more ideas to get any clue about what
is happening.

Our configuration:

Mapserver 4.10.2
Postgres 8.3.5
PHP 5.2.6
Centos  5.2

Here is the layer declaration of the map file:

LAYER
NAME "postgislayer"
CONNECTIONTYPE postgis
CONNECTION "host=localhost user=**** password=***** dbname=*****"
DATA "wkb_geometry from postgislayer using unique ogc_fid using SRID=32629"
STATUS ON
TYPE polygon
CLASS
COLOR 0 0 255
OUTLINECOLOR 0 0 255
END
PROJECTION
"init=epsg:32629"
 END
METADATA
"wms_title" "Test Layer"
"wms_srs" "epsg:32629"
END
END


My php code is as follows (just the wms wrapper from mapserver
documentation):

<?php
    $req_cgi = ms_newOwsRequestObj();
    if ($_SERVER['REQUEST_METHOD']=="POST")
    {
        foreach ($_POST as $key => $value)
        {
            $req_cgi->setparameter($key, $value);
        }
    }
    else
    {
        foreach ($_GET as $key => $value)
        {
            $req_cgi->setparameter($key, $value);
        }
    }
    ms_ioinstallstdouttobuffer();
    $oMap = ms_newMapobj($req_cgi->getvaluebyname("map"));
    $oMap->owsdispatch($req_cgi);
    //$contenttype = ms_iostripstdoutbuffercontenttype();
    if ($contenttype == '') header('Content-type: image/png');
    else
    {
        $header = 'Content-type: '.$contenttype;
        header($header);
    }
    ms_iogetStdoutBufferBytes();
    ms_ioresethandlers();
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090330/a8369492/attachment-0001.html


More information about the mapserver-users mailing list