PHP wrapper for mapserv CGI

Richard Greenwood richard.greenwood at GMAIL.COM
Mon Aug 20 17:39:32 EDT 2007


On 8/20/07, Frank Warmerdam <warmerdam at pobox.com> wrote:
> Richard Greenwood wrote:
> > I have been using the an ASP wrapper around mapserv.exe to hide my map
> > file and do some minor pre-processing that I don't want to do with
> > JavaScript on the browser. The technique is describe here:
> >    http://mapserver.gis.umn.edu/docs/howto/wms_server
> >
> > I'd like to do the same thing, but with PHP. The best I've go so far is:
> > <?php
> >   passthru("/www/cgi-bin/mapserv QUERY_STRING=map=/path/to/mapfile.map");
> > ?>
> > Which uses the QUERY_STRING option to execute mapserv in a "shell
> > mode". It works, but I wonder if there is a better way, and/or if this
> > is a bad way to do it.
>
> Rich,
>
> Certainly, if you pass the user's query string through to the commandline
> you need to be careful about quoting.  On Linux it should be sufficient
> I think to single quote the QUERY_STRING argument to mapserv.  In the
> above case, there are no options to pass extents or other values through.
> Is this just a highly simplified example or are you really not needing
> to pass anything from the original url?

That's is a very simplified example URL. I am usually very happy with
CGI, but I need to set a couple things in the query string before I
pass the request on to CGI mapserver.

I was kind of looking to see if anyone discouraged me from using the
QUERY_STRING argument because it was considered a bad practice, or
soon to be de-predicated, or some other pit fall.

I was also looking to see if there was a preferred PHP function, more
like "forward" in JSP. My PHP skills are pretty thin.

One reason that I stay with 'classic' mapserver over WMS is that, as
far as I can tell, WMS doesn't allow querying attribute data from
multiple spatial features, e.g. dragging a box over multiple objects
to select them. (But that probably belongs in a new thread).

As always, thank you very much for your reply.

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list