Hello,<br>I've tried to get mapserver up and running with GDAL to display a raster image from a php webpage but have been largely unsuccessful. This post will be relatively long as I describe all that I've tried to do to get it working. My development platform is Fedora Core 6.
<br><br>First I tried all the needed packages obtained from the Fedora repositories. I ran in to issues with php and gd not cooperating. So I downloaded php from and built from source (v5.2.1).<br><br>After php was installed and operational, I tried to get mapserver running (
v4.10.1). After I successfully built (with config options --without-pdf --with-httpd=/usr/sbin/httpd --with-php=/usr/local/src/php-5.2.1 --with-proj --with-gdal), I copied the php_mapscript.so file to the php modules direcotry. I started receiving errors along the lines of no output format for GTIFF ( I appologies for the vagueness, but I didn't write it down and I don't remember what it specifically was).
<br><br>Next, I downloaded from source GDAL and built it (with config options --with-png --with-jpeg --with-gif --with-libtiff --with-hdf4 --with-hdf5 --with-jasper --with-mysql). Then I did a make install and rebuild mapserver with the option --with-gdal=/usr/local/bin/gdal-config. I also copied over the new php_mapscript. At this point, I am still unable to draw a singular raster image with mapserver. My exact error message is:
<br><br><b>Warning</b>: [MapServer Error]: msDrawMap(): Failed to draw layer named 'TestLayer'.
in <b>/var/www/html/ryan/test.php</b> on line <b>9</b><br>
<br>
<b>Warning</b>: [MapServer Error]: msDrawRaster(): (/usr/share/images/test.png)
in <b>/var/www/html/ryan/test.php</b> on line <b>9</b><br><br>I've tried an older version of GDAL (1.4.0) with the same results. gdalinfo correctly opens and displays info on my image file, resolution and type (png).
<br><br>Here is my php file:<br><?php<br><br>$map_path="/var/www/html/ryan/map/";<br><br>dl('php_mapscript.so');<br><br>$map = ms_newMapObj($map_path."test.map");<br>//$map->selectOutputFormat("image/png");
<br>$image=$map->draw();<br>$image_url=$image->saveWebImage();<br><br>?><br><br><HTML><br> <HEAD><br> <TITLE>Test</TITLE><br> </HEAD><br> <BODY><br> <IMG SRC=<?php echo $image_url; ?> >
<br> </BODY><br></HTML><br><br>and here is my mapfile:<br>Map<br> Name TESTMAPFILE<br> Status On<br> Imagetype PNG<br> Size 800 600<br> Extent -82 40 -80 42 #example location<br> Units dd<br>
<br> Web<br> Imagepath "/var/www/html/ryan/map/"<br> Imageurl "/ryan/map/"<br> End<br><br> Layer<br> Name "TestLayer"<br> Type Raster<br> Status On
<br> Data "/usr/share/images/test.png"<br> End<br><br> OutputFormat<br> Name png<br> Driver "GD/PNG"<br> Mimetype "image/png"<br> ImageMode RGB<br> Extension "png"
<br> End<br><br>End<br><br>I am at the end of my rope trying to get this to work. If anyone can provide any direction, I would greatly appreciate any insight.<br><br>Thanks,<br>Ryan<br><br>