To configure Apache 2.2 with PHP using the mod_fcgi module in FreeBSD, follow these steps:
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.
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.
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.
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.
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.