[Mapserver-users] PHP/Mapscript Newbie needs help, Segmentation faults and blank images, nothing in logs

Ed Martin edman007x at mac.com
Wed Nov 26 21:01:54 EST 2003


ok this is my first time using php/mapscript so i'm starting off simple 
just draw the map, scale bar and reference image, i'm using the itasca 
mapserver demo and have commented out all layers but one, i have also 
changed all the images in it to png's from gifs so it would work with 
gd and i have changed the map file accordingly, so i made a few simple 
scripts based on the test draw thing included with mapscript and they 
should out put the images

so here are the php files i have

<?
require_once ('../inc/conf.inc.php');//get config
//load mapscript
dl("php_mapscript.so");
header("Content-type: image/jpeg");
//start map
$map = ms_newMapObj("itasca/demo.map");
$img = $map->draw();
$img->saveImage('');
?>

in my my browser the image shows up fine, but when run from the command 
line i get the headers, garbled text (what i expect), followed by 
Segmentation fault, what is that

then i have this one to make the reference image

<?
require_once ('../inc/conf.inc.php');//get config
//load mapscript
dl("php_mapscript.so");
header("Content-type: image/jpeg");
// start map
$map = ms_newMapObj("itasca/demo.map");
$img = $map->drawReferenceMap();
$img->saveImage('');
?>

in my browser if outputs a yellow image (yellow is what is set in the 
.map file), but there is no picture of anything, just yellow, shouldn't 
it be based on the reference image referred to in the .map file, when 
run in the command line i get headers and garbled text, exactly what i 
expect

then i have this to draw the scale bar

<?
require_once ('../inc/conf.inc.php');//get config
//load mapscript
dl("php_mapscript.so");
header("Content-type: image/jpeg");
//start map
$map = ms_newMapObj("itasca/demo.map");
$img = $map->drawScaleBar();
$img->saveImage('');
?>

in my browser i get a blank page (not a white image) and when run in 
the command line i get the headers followed by "Segmentation fault"

what is this Segmentation fault and what is causing it, all the scripts 
are the same except for one function, i have display errors on and log 
them, tried disabling the headers, and the errors are all logged and 
error reporting is set to E_ALL and i get no errors anywhere

and why isn't the reference map showing anything but the color 
specified in the .map file, there are no gifs and gd supports png's, 
everything is being output as jpegs

i am using php 4.3.4 as a CGI with apache 2.0.48 on slackware linux 9.0

any help would be great

Thanks in Advanced!




More information about the mapserver-users mailing list