[ms4w-users] RE: Anybody used mod_fcgid with MS4W

Marcelo Oliveira moliveira at GEOSTATS.com
Thu Apr 26 09:56:46 EDT 2007

Hi There,

I got MapServer to work in fastCGI mode with mod_fcgid and MS4W 1.40 on
Windows Server 2003 R2 SP1.  Here is what I had to do:

1. Downloaded the mod_fcgid.so binary build from:

2. Placed the mod_fcgid.so on Apache's modules directory

3. Placed the httpd.exe.manifest file on Apache's bin directory (this
file comes in the fcgid binary distribution from Apache Lounge)

4. Copied the entire contents of the cgi-bin directory to htdocs/fcgid
(should probably move this so that it is parallel with cgi-bin)

5. Added the following lines to the Apache httpd.conf (these assume that
you have ms4w on the c: drive and Windows installed on C:\Windows):

LoadModule fcgid_module modules/mod_fcgid.so
# set environment vars necessary for MapServer
DefaultInitEnv PROJ_LIB "c:/ms4w/proj/nad/"
DefaultInitEnv PATH
DefaultInitEnv windir "c:/WINDOWS"
DefaultInitEnv SystemRoot "c:/Windows"
DefaultInitEnv SystemDrive "c:"
DefaultInitEnv GDAL_DATA "c:/ms4w/gdaldata"
DefaultInitEnv GDAL_DRIVER_PATH "c:/ms4w/gdalplugins"
DefaultInitEnv TMP "c:/ms4w/tmp"
<Location /fcgid>
    SetHandler fcgid-script
    Options execCGI
    AllowOverride None
    Order allow,deny
    Allow from all

6. Restarted Apache

7. Changed the MapServer http calls from
http://server/cgi-bin/mapserv.exe to http://server/fcgid/mapserv.exe

8. To benefit from the persistence of mapserv.exe in fastCGI mode you
should add the following line to the LAYER sections in your map files
with expensice connections (e.g. PostGIS, ArcSDE, etc):

That's it! After getting this working I saw a four-fold improvement on
the drawing of maps (from 0.4 to 0.1 second on average, using a large
PostGIS database with the entire US's street network and other
background layers). 

I hope this helps other people out there trying to use MapServer in
fastCGI mode and without the resources to build fcgi-2.4.0 from scratch.


Marcelo Simas Oliveira
GeoStats LP
530 Means St., Ste. 310
Atlanta, Georgia 30318
(404) 588-1004

-----Original Message-----
From: Marcelo Oliveira 
Sent: Wednesday, April 25, 2007 8:32 PM
To: ms4w-users at lists.maptools.org
Subject: Anybody used mod_fcgid with MS4W


I am experimenting with MS4W 1.40 mod_fcgid
(http://fastcgi.coremail.cn/) and it keeps giving the following error
when trying to connect to PostGIS:

msDrawMap(): Image handling error. Failed to draw layer named 'States'.
msPOSTGISLayerOpen(): Query error. couldnt make connection to DB with
connect string 'user=postgres password=********* host=cabral port=5432

Error reported was 'could not translate host name &quot;cabral&quot; to
address: Unknown host '.

Has anybody seen this before, or let me rephrase that, has anybody
experimented with mod_fcgid before?



Marcelo Simas Oliveira
GeoStats LP
530 Means St., Ste. 310
Atlanta, Georgia 30318
(404) 588-1004

More information about the ms4w-users mailing list