{"id":940,"date":"2012-12-12T03:32:42","date_gmt":"2012-12-12T09:32:42","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=940"},"modified":"2026-03-26T23:35:25","modified_gmt":"2026-03-27T05:35:25","slug":"mod_fcgid","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/mod_fcgid\/","title":{"rendered":"How to Install and Configure mod_fcgid in Apache"},"content":{"rendered":"\n<p><strong>mod_fcgid<\/strong> is a high-performance Apache module designed to improve the execution of CGI applications. It was introduced as a binary-compatible replacement for FastCGI while providing better control over process management and resource usage.<\/p>\n\n\n\n<p>Unlike traditional CGI modules such as <strong>mod_cgi<\/strong> or <strong>mod_cgid<\/strong>, mod_fcgid keeps application processes running in the background, allowing them to handle multiple requests efficiently without restarting for every connection.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Use mod_fcgid?<\/h2>\n\n\n\n<p>mod_fcgid offers several advantages:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Improved performance compared to CGI<\/li>\n\n\n\n<li>Better process spawning control<\/li>\n\n\n\n<li>Reduced server load<\/li>\n\n\n\n<li>Faster handling of concurrent requests<\/li>\n\n\n\n<li>Optimized memory usage<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installing mod_fcgid<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install Apache Components<\/h3>\n\n\n\n<p>On <strong>Red Hat<\/strong> or <strong>CentOS<\/strong> systems, install Apache with the threaded MPM Worker module to reduce memory consumption:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install apache2-mpm-worker libapache2-mod-fcgid<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Enable the fcgid Module<\/h3>\n\n\n\n<p>Enable the Apache fcgid module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2enmod fcgid<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Install PHP CGI Packages<\/h3>\n\n\n\n<p>Install PHP CGI and required extensions if they are not already available:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install php5-cgi php5-curl php5-gd php5-mysql<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configuring mod_fcgid<\/h2>\n\n\n\n<p>To configure mod_fcgid, create a new configuration file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create Configuration File<\/h3>\n\n\n\n<p>Create the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/etc\/apache2\/conf.d\/php-fcgid.conf<\/code><\/pre>\n\n\n\n<p>Add the following configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AddHandler fcgid-script .fcgi .php<br>DefaultInitEnv PHPRC \"\/etc\/php5\/cgi\"<br>FCGIWrapper \/usr\/bin\/php-cgi .phpMaxRequestsPerProcess 1000<br>MaxProcessCount 10<br>IPCCommTimeout 240<br>IdleTimeout 240ServerLimit 500<br>StartServers 3<br>MinSpareThreads 3<br>MaxSpareThreads 10<br>ThreadsPerChild 10<br>MaxClients 300<br>MaxRequestsPerChild 1000<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Configuration for High-Traffic Servers<\/h3>\n\n\n\n<p>For servers with higher CPU and memory resources, use optimized settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AddHandler fcgid-script .fcgi .php<br>DefaultInitEnv PHPRC \"\/etc\/php5\/cgi\"<br>FCGIWrapper \/usr\/bin\/php-cgi .phpMaxRequestsPerProcess 1500<br>MaxProcessCount 45<br>IPCCommTimeout 240<br>IdleTimeout 240ServerLimit 2048<br>ThreadLimit 100<br>StartServers 10<br>MinSpareThreads 30<br>MaxSpareThreads 100<br>ThreadsPerChild 64<br>MaxClients 2048<br>MaxRequestsPerChild 5000<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Enable ExecCGI in Virtual Hosts<\/h3>\n\n\n\n<p>Add <strong>ExecCGI<\/strong> to the Apache virtual host configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Order Allow,Deny<br>Allow from All<br>AllowOverride All<br>Options MultiViews Indexes Includes FollowSymLinks ExecCGI<\/code><\/pre>\n\n\n\n<p>This allows PHP and fcgid scripts to execute correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Restart Apache<\/h2>\n\n\n\n<p>After completing the configuration, restart Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service httpd restart<\/code><\/pre>\n\n\n\n<p>mod_fcgid should now be active and serving PHP requests efficiently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>mod_fcgid improves Apache performance by keeping CGI processes persistent and efficiently handling multiple requests. Proper configuration ensures better scalability, reduced resource consumption, and improved response times for PHP applications.<\/p>\n\n\n\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n\n\n\n<p class=\"has-text-align-center\"><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><\/a><\/span><\/span><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>mod_fcgid is a high-performance Apache module designed to improve the execution of CGI applications. It was introduced as a binary-compatible replacement for FastCGI while providing better control over process management&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[6,1],"tags":[],"class_list":["post-940","post","type-post","status-publish","format-standard","hentry","category-linux-basics","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=940"}],"version-history":[{"count":7,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/940\/revisions"}],"predecessor-version":[{"id":16724,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/940\/revisions\/16724"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}