1

I've installed the mod_fastcgi on my Apache and put LoadModule into my httpd.conf file.

When I do a phpinfo(), mod_fastcgi is in the loaded modules section, but the server API still shows up as Apache 2.0.

How do I change this?

1

1 Answer 1

3

Do the steps below:

  • Disable the php.conf file that is configured to run as Apache module:
    # mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.module
  • Create the php.fcgi file in /var/www/cgi-bin with something like this:
    #!/bin/bash
    PHP_CGI=/usr/bin/php-cgi
    exec $PHP_CGI
  • Modify the DocumentRoot or VirtualHost section to add the AddHandler and Action directive:
    ...
    AddHandler php5-fastcgi .php
    Action php5-fastcgi /cgi-bin/php.fcgi
    ...

Testing with phpinfo():

# lynx -dump http://localhost/info.php | grep 'Server API'
   Server API CGI/FastCGI
2
  • Does this mean a server can only serve up mod_php or fastcgi, but not both? Or is there a way to run both?
    – Jason
    Oct 12, 2015 at 18:36
  • Does Server API CGI/FastCGI mean that PHP runs using FastCGI or just CGI? Mar 16, 2020 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .