FreeBSD Configure Apache 2.2 PHP with FastCGI mod_fcgi Module

https:/‮ual.www/‬tturi.com
FreeBSD Configure Apache 2.2 PHP with FastCGI mod_fcgi Module

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

  1. Install Apache and PHP. You can install Apache and PHP using the pkg command:
pkg install apache22 mod_fcgi

This will install Apache 2.2 and the mod_fcgi module, which is used to run PHP scripts with Apache.

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

This will enable the mod_fcgi module in Apache.

  1. Configure PHP to use the mod_fcgi 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
cgi.fix_pathinfo=1

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

  1. Create a configuration file for the mod_fcgi module. Create a file called fcgid.conf in the /usr/local/etc/apache22/Includes directory and add the following lines:
<IfModule mod_fcgid.c>
    AddHandler fcgid-script .php
    FcgidWrapper /usr/local/bin/php-cgi .php
</IfModule>

This will configure the mod_fcgi module to handle PHP scripts 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 apache22 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_fcgi module. You can now create PHP scripts and place them in the Apache document root (usually /usr/local/www/apache22/data) to be executed by Apache.

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