MapScript 4.8.1, PHP 5.12, and segmentation faults rendering TrueType

David Badke dbadke at UVIC.CA
Mon Mar 6 16:47:50 EST 2006


We are having an odd problem with a new install of MapServer/MapScript 
4.8.1 on Red Hat Linux with PHP 5.12. Trying to generate a layer (via 
MapScript) containing TrueType fonts causes a segmentation fault when 
drawing (eg: $oImg = $oMap->draw()). Changing the map file to use bitmap 
fonts makes the error go away. The same map file run through MapServer 
cgi (using the sample template) generates the TrueType text correctly 
with no errors. The same MapScript PHP code running on a Windows XP 
(Apache) system, also with the same map file, works with TrueType. It's 
only MapScript on the Linux server that has a problem, and only with 
TrueType fonts - everything else works perfectly.

The server guys have recompiled everything, making sure the GD/FreeType 
versions are correct. As far as they are concerned, the installation is 
good to go. But still it crashes...

Any ideas the server guys can try?

David

--------------

The extremely simple PHP script is:

<?php
if (!extension_loaded('MapScript'))
    dl('php_mapscript.so');
$oMap = ms_newMapObj( 
'/home1t/taprhist/www/maps/user/map/vicbird1878.map' );
$oImg = $oMap->draw();
$szURL = $oImg->saveWebImage();
echo "<img src=$szURL>";
?>

The map file is:

MAP
  NAME "vicbird1878_map"
  STATUS ON
  EXTENT 0 -6739 10539 0
  SIZE 10540 6740
  SHAPEPATH "/home1t/taprhist/www/maps/user/data/"
  IMAGETYPE PNG
  IMAGECOLOR 156 170 177
  UNITS INCHES
  FONTSET "/home1t/taprhist/www/maps/user/font/fontset.fnt"
  SYMBOLSET "/home1t/taprhist/www/maps/user/symbol/generic.sym"
  DEBUG ON
  WEB
    IMAGEPATH "/home1t/taprhist/www/maps/htdocs/tmp/"
    IMAGEURL "http://lettuce.tapor.uvic.ca/~taprhist/maps/htdocs/tmp/"
    LOG "/home1t/taprhist/www/maps/htdocs/tmp/mapserv.log"
    TEMPLATE "/home1t/taprhist/www/maps/htdocs/ms_temp.html"
  END
  REFERENCE
    STATUS ON
    IMAGE "/home1t/taprhist/www/maps/user/data/vic1878key.png"
    SIZE 300 192
    EXTENT 0 -6739 10539 0
    COLOR -1 -1 -1
    OUTLINECOLOR 255 0 0
  END
  LEGEND
    STATUS ON
    TRANSPARENT ON
    KEYSIZE 20 10
    KEYSPACING 5 5
  END
  SCALEBAR
    STATUS OFF
    SIZE 200 3
  END
  LAYER
    NAME "Base"
    GROUP "Image"
    STATUS OFF
    DATA "vic1878.png"
    TYPE RASTER
  END
  LAYER
    NAME "Features"
    GROUP "Features"
    STATUS OFF
    DATA "vicbird1878"
    TYPE POINT
    MAXSCALE 200
    CLASS
      STYLE
        SYMBOL "triangle"
        COLOR 255 0 0
        SIZE 8
      END
    END
  END
  LAYER
    NAME "Labels"
    GROUP "Labels"
    STATUS DEFAULT
    DATA "vicbird1878"
    TYPE ANNOTATION
    LABELITEM "LABEL"
    MAXSCALE 150
    SYMBOLSCALE 71
    CLASS
      LABEL
        TYPE truetype
        FONT "webdings"
        ANTIALIAS FALSE
        SIZE 9
        POSITION UC
        OFFSET 0 8
        COLOR 0 0 0
        BACKGROUNDCOLOR 255 255 255
        MINSIZE 8
        MAXSIZE 10
        BUFFER 1
      END
    END
  END
END

-- 

David Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada



More information about the mapserver-users mailing list