Hi Andrew: In general the only things that need to be in your document root are 
graphics, scripts and pure HTML that will be 
directly accessible via a users browser. Assets like mapfiles, data, symbols 
and templates should be elsewhere. Those files will
need to be accessible (readable) by the user the web server is running under 
but should not be owned by that user.

The temp space for the images MapServer creates is also in document root but I 
consider that part of the overall setup and 
not a project component. That directory needs to be owned and writable by the 
user the web server runs as.

I often setup a project like so:

/project
  /data
  /mapfiles
  /templates
  /htdocs
    /javascript
    /images
    /html

and then symlink the htdocs directory into document root. Could just copy it 
too.

Your document root might look like:

/htdocs/
  /tmp (this is the MapServer temporary directory, owned by the user your httpd 
is running as)
  /project (this is a symlink to the main project's /htdocs directory)

As for your example files. 

1) In Hello.html, remove the hidden variable 'map-web-imagepath', it just 
confuses things.

2) In Hello.map, you're missing a closing END (which is why you see the error 
message you do). I believe if you add it you'll get 
the colored image you're expecting. Typically I indent all objects in mapfile 
to make it easier to debug:

MAP
  ... map level attributes ...

  WEB
    ... web level attributes ...
  END

  LAYER
    ... layer level attributes ...
  END
END

As for the book. It's just a bit dated and can't adequately cover all platforms 
(and MacOS isn't one of them). At a minimum you'll
need to use sudo most likely to run administrative commands.

Hope this helps...

Steve

________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Andrew Lewin 
[[email protected]]
Sent: Wednesday, June 23, 2010 1:44 PM
To: [email protected]
Subject: [mapserver-users] HTML Templates

Hi Listers,

I am trying to learn MapServe as a beginner and I am having lots of trouble 
with the fundamentals of setting up the program.  I am running Mac OSX Snow 
Leopard with Apache.

According to my httpd-conf file, my document root is /usr/local/apache2/htdocs/ 
; however, when I use the tutorial data the files need to be in my root 
directory i.e. /ws4w/etc... I thought that all the data had to be in the 
document root.  Can someone explain this to me please?

Another problem I am having...I bought the book "Beginning Mapserver: Open 
Source GIS Development".  The first simple example is a "Hello World" example.  
The program starts off with a "Click Me" botton and a broken image.  When you 
click on the button, it is supposed to show the "Hello World" text.  When I 
click, I get an error like this: "msLoadMap(): Premature End-of-File."  Below 
are the two files that I used for the program"

Hello.html
<html>
<head><title>MapServer Hello World</title></head>
<body>
        <form method=POST action="/cgi-bin/mapserv">
                <input type="submit" value="Click Me">
                <input type="hidden" name="map" 
value="/home1/mapdata/Hello.map">
                <input type="hidden" name="map-web-imagepath"
                        value="/usr/local/apache2/htdocs/">
        <form>
        <IMG SRC="[img]" width=400 height=300 border=0>
</body>
</html>

Hello.map
# This is our "Hello World" maple
NAME "Hello_World"
SIZE 400 300
IMAGECOLOR 249 245 186
IMAGETYPE png
EXTENT -1.00 -1.00 1.00 1.00
WEB
        TEMPLATE "http://192.168.2.12/~andrewlewin/hello.html";
        IMAGEPATH "/usr/local/apache2/htdocs/"
        IMAGEURL "/tmp/"
END

The book suggests that I should Configure MapServer and Apache like this:
shapes:
mkdir /home/mapdata
chown nobody:nobody /home/mapdata
chmod u+rx /home/mapdata

images:
mkdir /var/www/htdocs/tmp
chown nobody:nobody /var/www/htdocs/tmp
chmod u+rx /var/www/htdocs/tmp

The problem is that when I try to run these commands, I get a "Permission 
denied" error.  How can I get permission to do this.  I remember when I was 
installing the various components from binaries that there was a command to ask 
me for my password before I did anything to the directory, but I forgot.  Can 
anyone tell me?

Sorry for posting all this at once.  I believe once I figure out these problems 
I will be able to move on.

Thanks,

Andrew


Andrew Lewin, M.Sc., Adv. Dipl. GIS
President
Spatial-Conserve Inc.
www.spatialconserve.com
Email: [email protected]
Tel: (905) 639-4646
Mobile: (905) 630-8441
Skype: andrew.lewin99
Follow me on Twitter: www.twitter.com/arlewin




_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to