[ms4w-users] fcgid connexion problem

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Jul 10 19:16:18 EDT 2008

> Hi Jeff,
> Thank you very much for the quick answer.
> I have an other problem, unfortunately.  Here's the config I'm using :
> LoadModule fcgid_module modules/mod_fcgid.so
> <Directory "/ms4w/Apache/cgi-bin">
>   SetHandler fcgid-script
>   AllowOverride All
>   Options None
>   Order allow,deny
>   Allow from all
> </Directory>
> <IfModule fcgid_module>
>   IPCCommTimeout 60
>   IdleTimeout 60
>   DefaultMinClassProcessCount 2
>   DefaultMaxClassProcessCount 20
> </IfModule>
> And I added this line below my only layer in my mapfile :
> When I try to load a map, I get the following error in my  
> mapserver.log (I changed the name of the user, dbname, password and  
> layer for '....' in this example) :
> [Wed Jul 09 15:26:41 2008].375000 CGI Request 1 on process 6508
> [Wed Jul 09 15:26:41 2008].437000 FAILURE!!![Wed Jul 09 15:26:41  
> 2008].437000 msPOSTGISLayerOpen(): Query error. couldnt make  
> connection to DB with connect string 'user=.... password=....  
> dbname=.... host= port=5432'.
> Error reported was 'could not create socket: The requested service  
> provider could not be loaded or initialized.
> (0x0000277A/10106)
> '.
> This error occured when trying to make a connection to the specified  
> postgresql server.
> Most commonly this is caused by (1) incorrect connection string (2)  
> you didnt specify a 'user=...' in your connection string (3) the  
> postmaster (postgresql server) isnt running (4) you are not allowing  
> TCP/IP connection to the postmaster (5) your postmaster is not  
> running on the correct port - if its not on 5432 you must specify a  
> 'port=...' (6) the security on your system does not allow the  
> webserver (usually user 'nobody') to make socket connections to the  
> postmaster (7) you forgot to specify a 'host=...' if the postmaster  
> is on a different machine
> (8) you made a typo  [Wed Jul 09 15:26:41 2008].437000 msDrawMap():  
> Image handling error. Failed to draw layer named '....'.
> Is it possible that I can't connect to my postgres database using  
> fcgid ?  I tried to change the host to 'localhost' in the mapfile  
> and I get the same kind of error.  I checked in the Windows task  
> manager to see if mapserv.exe was using the same username (SYSTEM)  
> and it did...
> I'm a little confused, again.  Can you help me out ?
> _______________________________________________


This is definitely tricky.

I did some more testing and I was getting your exact error with a  
PostGIS connection.   The error mentions TCP/IP, and I remembered a  
mention of that on the mod_fcgid webpage (http://fastcgi.coremail.cn/doc.htm 
) saying to use the "DefaultInitEnv" settings....so I added them to  
the bottom of httpd.conf, restarted apache, and finally success!

	DefaultInitEnv PROJ_LIB    "c:/ms4w/proj/nad/"
	DefaultInitEnv PATH        "c:/ms4w/Apache/cgi-bin;c:/WINDOWS/ 
	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"
	DefaultInitEnv TEMP        "c:/ms4w/tmp"

And wow it DOES speed up map display!

So that's great.

However I tried testing mod_fcgid with an Oracle connection and I get  
a new error (actually another user got this same error when trying an  
SDE-mod-fcgid connection):

  	 [Thu Jul 10 18:51:55 2008] [warn] (OS 109)The pipe has been  
ended.  : mod_fcgid: get overlap result error
   	[Thu Jul 10 18:51:55 2008] [error] [client] Premature  
end of script headers: mapserv.exe, referer:

So I am disappointed with that.

But I hope this information helps you in your battles.

Jeff McKenna
FOSS4G Consulting and Training Services

More information about the ms4w-users mailing list