[ms4w-users] fastCgiServer with ms4w

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Jul 9 01:08:39 EDT 2008

On 8-Jul-08, at 4:32 PM, Alexandre Dubé wrote:

> Hi everyone,
> I'm trying to setup a fastCGIServer with ms4w and I can't figure out  
> how to make it work.
> Here's what I actually did :
> - I first copied mod_fcgi.so to my apache/modules folder
> - Then, installed Visual C++ 2008 Redistributable Package
> - Then added to my httpd.conf the following lines :
>     At line 117 : LoadModule fcgid_module modules/mod_fcgid.so
>         (if I change the filename it generates an error, so I assume  
> the module is loaded correctly)
>     At line 420 : AddHandler fastcgi-script fcgi
>     At line 138 : FastCgiConfig -minProcesses 2
>         ( this line is to test if the module works correctly )
> - When I try to restart apache, I get the following error :
> Syntax error on line 138 of C:/ms4w/Apache/conf/httpd.conf:
> Invalid command 'FastCgiConfig', perhaps misspelled or defined by a  
> module not i
> ncluded in the server configuration
> I don't understand why it can't understand the 'FastCgiConfig'  
> command, the module is supposed to be loaded...  Is there a way to  
> know if the fastCgi is correctly loaded ?  Or does anybody know  
> what's wrong with my configs ?  Something missing perhaps...
> -- 
> Alexandre Dubé
> Mapgears
> www.mapgears.com


I found the existing MS4W bug with some notes on this module (http://bugzilla.maptools.org/show_bug.cgi?id=1631 
).  I have added your initial comments.  If you can add any further  
findings of yours to that bug that would be great.  To answer your  
questions I made some notes as I worked through it all, which I have  
added to that bug and included below:

FastCGI Config notes

1) to see a list of loaded Apache modules:

    - cd to /Apache/bin
    - execute:
   			httpd -t -D DUMP_MODULES
      With a fresh (no changes out of the box) MS4W you will see:

      Loaded Modules:
  		core_module (static)
  		win32_module (static)
  		mpm_winnt_module (static)
  		http_module (static)
  		setenvif_module (shared)
	 Syntax OK
2) Edit Apache/conf/httpd.conf and add the following:

   - line#117     LoadModule fcgid_module modules/mod_fcgid.so
   - line#420     AddHandler fastcgi-script fcgi

    Without installing the Visual C 2008 runtimes, if I try viewing  
the modules again I get the following error:

   	httpd: Syntax error on line 118 of C:/ms4w/Apache/conf/httpd.conf:  
Cannot load
   	C:/ms4w/Apache/modules/mod_fcgid.so into server: This application  
has failed to
   	start because the application configuration is incorrect.  
Reinstalling the
   	application may fix this problem.
3) after installing Visual C 2008 runtimes (www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en) 
  try to view the modules again and look for the fcgid module at the  

      Loaded Modules:
  		core_module (static)
  		win32_module (static)
  		mpm_winnt_module (static)
  		http_module (static)
  		setenvif_module (shared)
  		fcgid_module (shared)
	 Syntax OK

4) If I place the "FastCgiConfig -minProcesses 2" command on line#145  
(after the 2 existing </IfModule> tags), and try listing the modules  
again I get the error:

	Syntax error on line 145 of C:/ms4w/Apache/conf/httpd.conf:
	Invalid command 'FastCgiConfig', perhaps misspelled or defined by a  
module not
	included in the server configuration

FastCgiConfig is actually a directive for the "mod_fastcgi" module  
(from fastcgi.com).  In our case however, we are using "mod_fcgid",  
and it has its own directives, which are all documented on http://fastcgi.coremail.cn/doc.htm

Therefore, around line#145 (after the existing </IfModule> tags), we  
could have:

	<IfModule fcgid_module>
   		DefaultMinClassProcessCount 3
Give those directives a try!


- the above testing was all done through commandline, which means that  
PATHs are often set nicely.  More testing must occur with mod_fcgid  
through the browser to make sure that appropriate environment  
variables are being set (these are documented on  http://fastcgi.coremail.cn/doc.htm)
- the above settings in httpd.conf will be added to the ms4w 2.2.8  
release (shortly!)

Jeff McKenna
FOSS4G Consulting and Training Services

More information about the ms4w-users mailing list