How to Setup Apache2 (HTTPD) with FastCGI and PHP on CentOS/RHEL 6/5

 

yum install mod_fastcgi
Loaded plugins: fastestmirror, replace
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.psychz.net
* epel: mirror.prgmr.com
* extras: mirrors.xmission.com
* rpmforge: mirror.webnx.com
* updates: mirrors.easynews.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package mod_fastcgi.x86_64 0:2.4.6-2.el5.rf will be installed
--> Finished Dependency Resolution

Dependencies Resolved
#!/bin/bash

==============================================================================================================
Package Arch Version Repository Size
==============================================================================================================
Installing:
mod_fastcgi x86_64 2.4.6-2.el5.rf rpmforge 133 k

Transaction Summary
==============================================================================================================
Install 1 Package(s)

Total download size: 133 k
Installed size: 364 k
Is this ok [y/N]: y
Downloading Packages:
mod_fastcgi-2.4.6-2.el5.rf.x86_64.rpm | 133 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mod_fastcgi-2.4.6-2.el5.rf.x86_64 1/1
# For example:
Verifying : mod_fastcgi-2.4.6-2.el5.rf.x86_64 1/1

Installed:
mod_fastcgi.x86_64 0:2.4.6-2.el5.rf

Complete!

vi /var/www/cgi-bin/php.fcgi

chmod +x php.fcgi; chown apache.apache php.fcgi

#!/bin/bash
PHPRC="/etc/php.ini"
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHPRC
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php-cgi
vi /etc/httpd/conf.d/cacti.conf
added
 Options +Indexes FollowSymLinks +ExecCGI
 AddHandler php5-fastcgi .php
 Action php5-fastcgi /cgi-bin/php.fastcgi

Restart apache

check phpinfo

Server API CGI/FastCGI

 

http://tecadmin.net/setup-httpd-with-fastcgi-and-php-on-centos-redhat/

Leave a Reply