[mapserver-users] php mapscript newbie

Hankley, Chip Chip.Hankley at gasai.com
Fri Nov 29 09:23:37 EST 2002


Mark... if IE (or any other browser) is spitting out the actual PHP code
(without some statement that says 'Error' or the like) - then the PHP is not
being parsed, and the web server is serving it up to the client (your
browser) as if it were text to display. Make sure that PHP is functioning
correctly first...

something simple like:

<H1>My name is <?echo "Mark";?></H2>

should simply print "My name is Mark"... if you get anything else, PHP isn't
working. At first glance, what you have (MapScript) looks OK.

Chip

-----Original Message-----
From: Mark Balman [mailto:Mark.Balman at birdlife.org.uk]
Sent: Friday, November 29, 2002 4:23 AM
To: 'mapserver-users at lists.gis.umn.edu'
Subject: [mapserver-users] php mapscript newbie


Hi All

I have sucessfully created a simple app using mapserver and polished this up
using Maplab. I am now wanting to enhance the functionality using php
mapscript. I have read the PHP/Mapscript by example HOWTO document and have
tried unsuccesfully to get a simple world map to display.

I have tried the following (using Win98, Apache, mapserver 3.6)
------------------mapfile----------------------------------
MAP
 SIZE 600 300
 STATUS ON
 SYMBOLSET ./symbols/symbols.sym
 EXTENT  -180 -90 180 90
 UNITS DD
 SHAPEPATH "./data"
 NAME test
			
WEB
 IMAGEPATH "/tmp/ms_tmp/"
 IMAGEURL "/ms_tmp/"
END
		
LAYER
 NAME world
 TYPE POLYGON
 STATUS ON
 DATA world
 CLASS
  COLOR 110 50 100
  OUTLINECOLOR 200 200 200
 END
END
		
END

-------------phpmapscript-------------------------------

<?php
		
dl('php_mapscript.dll'); 
		
$map_path="/world/";			
$map = ms_newMapObj($map_path."test.map");
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
		
?>
		
<HTML>
<HEAD>
<TITLE>Example 1: Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC=<?php echo $image_url; ?> >
</BODY>
</HTML>

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

When I try and open the file I get the following displayed in IE4 :(
draw(); $image_url=$image->saveWebImage(MS_GIF,1,1,0); ?> >

Can anyone enlighten me as to what I am doing wrong?
Thanks in advance
Mark 



More information about the mapserver-users mailing list