# apache22 and mod_fcgid issues



## saiman (Jun 15, 2010)

Hello,
I'm trying to run apache22 with mod_fcgid under FreeBSD 8 RELEASE. I have installed both via ports. I've got this one to load the fcgid module:


```
LoadModule fcgid_module libexec/apache22/mod_fcgid.so
```

And I moved all fcgid configuration variables into a file extra/httpd-fcgid.conf with the following content:


```
# cat extra/httpd-fcgid.conf
# FastCGI configuration
<IfModule mod_fcgid.c>
# IdleTimeout n (300 seconds)
# An idle fastcgi application will be terminated after IdleTimeout seconds.
FcgidIdleTimeout 900

# IdleScanInterval n (120 seconds)
# The scan interval for idle fastcgi applications.
FcgidIdleScanInterval 120

# BusyTimeout n (300 seconds)
# A fastcgi application will be terminated if handing a single request
# longer than busy timeout.
FcgidBusyTimeout 300

# BusyScanInterval n (120 seconds)
# The scan interval for busy timeout fastcgi applications.
FcgidBusyScanInterval 120

# ErrorScanInterval n (3 seconds)
# The scan interval for exit pending fastcgi applications. fastcgi
# applications will be terminated within this scanning.
FcgidErrorScanInterval 9

# ZombieScanInterval n (3 seconds)
# The scan interval for zombie process. 
FcgidZombieScanInterval 9

# ProcessLifeTime n (3600 seconds)
# A fastcgi application will be terminated if lifetime expired,
# even no error is detected.
FcgidProcessLifeTime 3600

# SocketPath path (logs/fcgidsock)
# The directory to put the UNIX domain socket. (UNIX only)
# This directory should be writable only by apache user
FcgidIPCDir /tmp/fcgi_ipc

# SpawnScoreUpLimit n (10)
# The spawn-speed control score up water limit. Score increases while
# a process is spawned or terminated, and decreases as time progresses;
# while the score is higher than SpawnScoreUpLimit, the spawning will be
# held for a while. The higher this number is, the higher speed of the
# spawning can be.
FcgidSpawnScoreUpLimit 10

# SpawnScore n (1)
# The weight of spawning.  This weight will be plused to the spawn-control
# score on every spawn. The higher this number is, the lower speed of
# spawning can be.
FcgidSpawnScore 1

# TerminationScore n (2)
# The weight of termination. This weight will be plused to the score while
# fastcgi process terminates. The higher this number is, the lower speed
# of spawning can be.
FcgidTerminationScore 2

# MaxProcessCount n (1000)
# The max count of total fastcgi process count.
FcgidMaxProcesses 128

# DefaultMaxClassProcessCount n (100)
# The maximum number of fastcgi application instances allowed to run for
# particular one fastcgi application. 
FcgidMaxProcessesPerClass 64 

# DefaultMinClassProcessCount n (3)
# The minimum number of fastcgi application instances for any one fastcgi
# application. 
# Idle fastcgi will not be killed if their count is less than n
# Set this to 0, and tweak IdleTimeout
FcgidMinProcessesPerClass 0

# DefaultInitEnv  env_name env_value
# The default environment variables before a fastcgi application
# is spawned. You can set this configuration more than once.

# IPCConnectTimeout n (3 seconds)
# The connect timeout to a fastcgi application. 
FcgidConnectTimeout 9

# IPCCommTimeout n (20 seconds)
# The communication timeout to a fastcgi application. Please increase this
#  value if your CGI have a slow initialization or slow respond.
FcgidIOTimeout 60

# OutputBufferSize n (64k bytes)
# CGI output cache buffer size.

# PHP_Fix_Pathinfo_Enable n(n=0/1, default 0)
# If you are using PHP and set cgi.fix_pathinfo=1 in php.ini, set PHP_Fix_Pathinfo_Enable 1. 
# From php.ini:
# cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
# previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
# what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
# this to 1 will cause PHP CGI to fix it's paths to conform to the spec.  A setting
# of zero causes PHP to behave as before.  Default is zero.  You should fix your scripts
# to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
# cgi.fix_pathinfo=1
#PHP_Fix_Pathinfo_Enable 1

# MaxRequestsPerProcess parameter allows mod_fcgid to exit after handling a certain
# number of requests, similar to the existing ProcessLifeTime option. 
FcgidMaxRequestsPerProcess 1000

AddHandler fcgid-script .fcgi
</IfModule>
```

Here is the result from apache restart:


```
Performing sanity check on apache22 configuration:
Syntax error on line 5 of /usr/local/etc/apache22/extra/httpd-fcgid.conf:
Invalid command 'FcgidIdleTimeout', perhaps misspelled or defined by a module not included in the server configuration
```

Any suggestions how to run fcgid with apache22 are welcome. Thanks in advance!


----------



## DutchDaemon (Jun 15, 2010)

Does the module actually show up in [cmd=]httpd -M[/cmd]
?


----------



## saiman (Jun 15, 2010)

Hello,
I comment this one - "Include etc/apache22/extra/httpd-fcgid.conf" in my httpd.conf to start the apache. And here is the result:


```
# /usr/local/sbin/httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 authn_file_module (shared)
 authn_dbm_module (shared)
 authn_anon_module (shared)
 authn_default_module (shared)
 authn_alias_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_dbm_module (shared)
 authz_owner_module (shared)
 authz_default_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 file_cache_module (shared)
 cache_module (shared)
 disk_cache_module (shared)
 dumpio_module (shared)
 include_module (shared)
 filter_module (shared)
 charset_lite_module (shared)
 deflate_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 mime_magic_module (shared)
 cern_meta_module (shared)
 expires_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 unique_id_module (shared)
 setenvif_module (shared)
 version_module (shared)
 ssl_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 asis_module (shared)
 info_module (shared)
 suexec_module (shared)
 cgi_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 imagemap_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 fcgid_module (shared)
Syntax OK
```

Probably the last one is important:  *fcgid_module (shared)*. In my opinion it's loaded. I have to note that it's possible to start the apache only without FCGID configuration options.

Regards,
S.


----------



## DutchDaemon (Jun 15, 2010)

I know the directives for fcgi were changed a while ago, but could you try (just to test) whether changing 
	
	



```
FcgidIdleTimeout 900
```
 to 
	
	



```
IdleTimeout 900
```
 at least gets you one step further?


----------



## saiman (Jun 16, 2010)

That's the problem! I installed apache and mod_fcgid without updating ports, after syncing ports and upgrading the apache and mod_fcgid everything works just fine.
Thanks!


----------



## DutchDaemon (Jun 16, 2010)

So you had the old port with the older syntax, I presume. Ok.


----------



## laytone (Nov 21, 2011)

*How?*



			
				saiman said:
			
		

> That's the problem! I installed apache and mod_fcgid without updating ports, after syncing ports and upgrading the apache and mod_fcgid everything works just fine.
> Thanks!



How did you "after syncing ports and upgrading the apache and mod_fcgid everything works just fine" I seem to be running the latest version of apache, however I'm still having this problem.  Thanks.


----------

