I'm trying to run PHP as FastCGI with no success.

I made a *.conf file such on mod_fcgid page but without a wrapper script.

Here is my conf:

# php5 as FastCGI executable
FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in
# php.ini:
# FcgidFixPathinfo 1

<Location "D:/www">
    AddHandler fcgid-script .php
    Options +ExecCGI
    FcgidWrapper "C:/php/php-cgi.exe" .php

    # Customize the next two directives for your requirements.
    Order allow,deny
    Allow from all

The server start normally and fcgid_module is shown with httpd -M, but php files are server as plain text.


Out of curiosity, try changing your line:

AddHandler fcgid-script .php


AddHandler fcgid-script php

In order to get yourself up and running, you might also want to consider using mod_fastcgi (note, not mod_fcgid from Apache). A dll is available here http://www.fastcgi.com/dist/mod_fastcgi-2.4.6-AP22.dll Note that this is for Httpd 2.2. (A dll for 2.4 is also available.)

Your config entry would look something like:

LoadModule fcgid_module modules/mod_fcgid.so
<IfModule mod_fastcgi.c>
    Alias /fcgi-bin "C:/www/cgi-bin"
    FastCgiServer "C:/www/cgi-bin/php-cgi.exe" -initial-env PATH=C:/php -initial-env PHPRC=C:/php
    AddHandler php-fastcgi .php
    <Location /fcgi-bin/>
        Options ExecCGI
        SetHandler php-fastcgi
    AddType application/x-httpd-fastphp .php
    Action php-fastcgi /fcgi-bin/php-cgi.exe

You can probably get away with less, but it works for me on windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.