-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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: http://server.tld/cgi-bin/mapserv 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 [1]. 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 [2] > 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> > Put this html file in your document root. OR 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. Try this: > Hello.map > # This is our "Hello World" maple MAP 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 "/home/andrewlewin/public_html/" IMAGEURL "/~andrewlewin/tmp/" END END (Thats the shortest mapfile I've ever seen, but it that doesn't mean its wrong) > > 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 > Maybe its better to stay in you home directory: mkdir /home/andrewlewin/mapdata 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> > images: > 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. mkdir /home/andrewlewin/public_html/tmp 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 you home. 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. Lars [1] http://mapserver.org/development/rfc/ms-rfc-56.html [2] http://mapserver.org/tutorial/index.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwiYr0ACgkQ0GRF77ebR/k30ACdGN/C8ceTX1JtOJUe7kw89qfW CHYAn17eUvOhBSt/QKVk4JLXbs9KnrfW =snkp -----END PGP SIGNATURE----- _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
