FreeBSD Configure Apache PHP with mod_fastcgi Module

https://‮tual.www‬turi.com
FreeBSD Configure Apache PHP with mod_fastcgi Module

To configure Apache with PHP using the mod_fastcgi module in FreeBSD, follow these steps:

  1. Install the Apache HTTP server and PHP. You can install Apache and PHP using the pkg command:
pkg install apache24 mod_fastcgi

This will install the Apache HTTP server and the mod_fastcgi module, which is used to run PHP scripts with Apache.

  1. Enable the mod_fastcgi module in Apache. Open the Apache configuration file, which is typically located at /usr/local/etc/apache24/httpd.conf, in a text editor and add the following line:
LoadModule fastcgi_module libexec/apache24/mod_fastcgi.so

This will enable the mod_fastcgi module in Apache.

  1. Configure PHP to use the mod_fastcgi module. Open the PHP configuration file, which is typically located at /usr/local/etc/php.ini, in a text editor and add the following lines:
engine = On
fastcgi.server = {
    ".php" => {
        "localhost:9000" => {
            "bin-path" => "/usr/local/bin/php-cgi",
            "min-procs" => 1,
            "max-procs" => 1,
            "idle-timeout" => 20
        }
    }
}

This will configure PHP to use the mod_fastcgi module and specify the location of the php-cgi executable.

  1. Restart Apache to apply the changes. You can restart Apache by running the following command:
service apache24 restart

This will restart Apache and apply the changes that you made to the configuration files.

After completing these steps, Apache and PHP will be configured to use the mod_fastcgi module. You can now create PHP scripts and place them in the Apache document root (usually /usr/local/www/apache24/data) to be executed by Apache.

Created Time:2017-10-28 20:40:33  Author:lautturi