[mapserver-users] HTML Templates
ml at lingner.eu
Wed Jun 23 15:38:37 EDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Am 23.06.2010 20:44, schrieb Andrew Lewin:
> 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.
I'm not familiar with OSX but I hope to be at least of some help.
> 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?
In your htdocs folder you have to place everything which should be
delivered by your webserver, in this case apache.
So here you place any html or php files you need for your application as
well as icons or images you need.
When you put files in here make sure apache can read them. Its usually a
good idea to make apache own the files.
Then you have your mapserver application staying in a directory
configured for cgi applications, like mapserver is.
In the end mapserver can be called by an URL like this:
Configuration files for almost all applications stay in /etc, so for
apache its /etc/apache2. There is also the configuration where the cgi
directory and your document root is configured.
To build an mapserver application you need a mapfile and some data you
want to show. You don't want to put this in your document root, because
then these files would be accessible by anyone.
If you are using an mapserver version > 5.0 then you need obey some
rules which are described in . Basically your mapfile has to start
with the keyword MAP
> 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"
premature end of file means that something with your mapfile is wrong.
Could be a missing quote, a missing keyword...
Maybe the examples in the book are a little old (I don't know this
tutorial). You can take a look at the tutorials on the mapserver website 
> <head><title>MapServer Hello World</title></head>
> <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"
> <IMG SRC="[img]" width=400 height=300 border=0>
Put this html file in your document root.
It looks like you can also use an public_html folder in your home
directory. Maybe I'm wrong here, but this would work on debian and
ubuntu, if apache is configured with mod_userdir.
> # This is our "Hello World" maple
SIZE 400 300
IMAGECOLOR 249 245 186
EXTENT -1.00 -1.00 1.00 1.00
(Thats the shortest mapfile I've ever seen, but it that doesn't mean its
> The book suggests that I should Configure MapServer and Apache like this:
> mkdir /home/mapdata
> chown nobody:nobody /home/mapdata
> chmod u+rx /home/mapdata
Maybe its better to stay in you home directory:
chown nobody:nobody /home/andrewlewin/mapdata
chmod u+rx /home/andrewlewin/mapdata
If apache is not configured with user and group nobody you need to
change nobody:nobody to the right <username>:<groupname>
> mkdir /var/www/htdocs/tmp
> chown nobody:nobody /var/www/htdocs/tmp
> chmod u+rx /var/www/htdocs/tmp
You can probably use also an directory underneath you home.
chown nobody:nobody /home/andrewlewin/public_html/tmp
chmod u+rx /home/andrewlewin/public_html/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.
The error means your user account don't have permissions to create the
directory. Use a user which has the permission or place the directory in
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.
Good luck. To setup such an environment the very first time looks always
complicated. But when you have it running you will see that everything
fits well together ;)
If there are any further questions, let this list know.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the mapserver-users