Apache FastCGI display Website not correct

Michael Powell nightrecon at hotmail.com
Wed Mar 2 16:05:56 UTC 2011

Silvio Siefke wrote:

> Hello,
> i use fastcgi with PHP-FPM on Apache 2.2.17. When i go on Website with
> FastCGI then the page load not complete.
> http://mail.silviosiefke.de/fastcgi_apache.png
> When i run with FCGID then the page load complete.
> http://mail.silviosiefke.de/fcgid_apache.png
> Has someone a idea what is the problem? Thank you.
Strictly _not_ a FreeBSD issue, but FWIW I thought maybe I'd respond anyway.

Someone please correct me if I'm wrong here, as I haven't been keeping up 
with the latest Apache news and stuff so the following may be out of touch. 
I thought that at some point a couple of years ago that FastCGI became 
deprecated in favor of mod_fcgid. Look at the dates on this page:


Apache has absorbed the mod_fcgid into the mainstream. Notice the dates on 
the support page below seem to be more recent:


Since your website works OK with mod_fcgid why not use it because it works?

I use Apache with the event mpm and mod_fcgid, but am still using PHP 5.2.x. 
For purposes of this problem the difference between my use of the event mpm 
and you using worker should probably not be significant. I cannot properly 
address your question concerning FastCGI as I do not use it. What I can do 
is share some of my configs for my web development server using mod_fcgid.

LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
#LoadModule php5_module        libexec/apache22/libphp5.so
LoadModule fcgid_module libexec/apache22/mod_fcgid.so

<Directory "/usr/local/www/apache22/data">

SetOutputFilter Deflate

AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript 
application/javascript application/x-javascript text/xml application/xml 

SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary

    Options Indexes FollowSymLinks

    AllowOverride All
    Order allow,deny
    Allow from all

    # added for mod_fcgid
    #SetHandler fcgid-script
    FCGIWrapper /usr/local/bin/php-cgi .php
    Options ExecCGI
    # end of mod_fcgid change


# added to enable mod_fcgid:

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .fcgi .php
  SocketPath /var/run/fcgidsock/
  #SocketPath /var/run/fcgid_shm
  IPCConnectTimeout 10
  IPCCommTimeout 20
  OutputBufferSize 0
  MaxRequestsPerProcess 1024

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.

<IfModule dir_module>
    DirectoryIndex index.html index.php

This is for the main site. In addition I only have one virtual host and the 
httpd-vhosts.conf looks like this:

NameVirtualHost *:80

    ServerAdmin webmaster at test.zip
    DocumentRoot "/usr/local/www/apache22/oldriver.test.zip"
    ServerName oldriver.test.zip
    ServerAlias oldriver.test.zip
    ErrorLog "/var/log/httpd-error.log"
    CustomLog "/var/log/httpd-access.log" common
<Directory /usr/local/www/apache22/oldriver.test.zip>
    Options Indexes FollowSymLinks
    FCGIWrapper /usr/local/bin/php-cgi .php
    Options ExecCGI
    DirectoryIndex index.html index.php home.php
       AllowOverride All
        Order deny,allow
        allow from all

Your requirements are likely somewhat different from mine, so these configs 
work for me but you should only consider them as examples. If any of it may 
be useful adjust accordingly. Consider using mod_fcgid instead of FastCGI 
because it is newer and more currently under active support. That is, unless 
you have some other overriding reason that makes you forced to use FastCGI.


More information about the freebsd-questions mailing list