0

I am trying to work through the mapserver tutorialhttp://mapserver.org/tutorial/index.html .

I am working on a Mac (with 10.9) and I have installed mapserver from http://www.kyngchaos.com/software/mapserver. I have apache running and I have copied the tutorial document into apache's document root ("/Library/WebServer/Documents"). All the files are world readable so apache should be able to read them. I have also verified the permissions in httpd.conf.

When I try and access the first tutorial at http://localhost/cgi-bin/mapserv?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map I get msLoadMap(): Unable to access file. (/ms4w/apps/tutorial/htdocs/example1-1.map).

Is there a separate mapserver config file that I have missed?

And where is mapserver looking for the files?

  • What's interesting here is the /ms4w part, = MapServer for Windows, so it's surprising that it works on a Mac. But I guess that's what KyngChaos distro is, a repackaging of the Ms4W distro for a Mac? – nmtoken Jan 24 at 17:29
  • MapServer doesn't have a document root – nmtoken Jan 24 at 17:36
1

It is best to use the absolute path as path to mapfile. I am not sure about how the default root for the mapfile location is set but at least it is not the document root of Apache. That is not a good idea either to place mapfiles under the document root, you do not want to give even read access to them for the web users. Only Mapserver needs to reach them from the file system. However, for going through the tutorial it is not critical. I suppose that this should work for you

map=/Library/WebServer/Documents/ms4w/apps/tutorial/htdocs/example1-1.map

  • Yes, it is an absolute path. I'll move it from the web accessible tree. Thanks! – Russell Fulton Jun 10 '14 at 7:39
1

Just to add some additional clarity here for others following along with the tutorial...

For Linux/Ubuntu:

After installing Apache and PHP, you can copy the "ms4w" folder to an absolute path such as:

/data/ms4w

To load a map in your browser, the url would be something like:

http://127.0.0.1/cgi-bin/mapserv?map=/data/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map
  • or just use Apache config to hide the map file, works for Linux or Windows – nmtoken Jan 24 at 17:36
1

I don't think it is possible for your map file to be in the location you specified because it has MS4W and that's a Windows installation (you use a Mac). So I think the tutorial assumed you used MS4W to install MapServer.

Use absolute path like c:/..mapfile.map

Certainly would be worth looking at the MS4W documentation for guidance, as it has content that's not part of a standard MapServer installation.

  • the turuorial data is machine independent. It comes in a zip file which you unpack. The problem is that the tutorial instructions don't say where to unpack it so I put it in the document root of the web server. – Russell Fulton Jun 9 '14 at 20:15
  • did you work it out? if not try putting the map file in c:/ and in the url put c:/mapfile.map – dowi Jun 10 '14 at 6:09
  • I have it working fine. The answer to the original question is that mapserver takes a absolute path name from the root of the file system. So in windows drive:/map_file or in UNIX /home/user/... or whatever – Russell Fulton Jun 11 '14 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.