Tutorials

:: CentOS: Apache2 worker MPM, FCGI, APC

:: Installing Apache2, FCGI, APC

yum install httpd php-cgi mod_fcgid php-pecl-apc

 
:: Enable worker MPM on Apache2

vi /etc/sysconfig/httpd
# uncomment
HTTPD=/usr/sbin/httpd.worker

 
:: Disable mod_php on Apache2

cd /etc/httpd/conf.d/
mv php.conf php.conf.orig

 
:: Setup FCGI for php script
+ enable cgi.fix_pathinfo on php.ini

vi /etc/php.ini
# uncomment
cgi.fix_pathinfo = 1

+ add php script handle on fcgi

vi /etc/httpd/conf.d/fcgid.conf
# add fcgi for php
AddHandler fcgid-script .php
FCGIWrapper /var/www/cgi-bin/php-fcgi-daemon .php
AddType text/html .php
DirectoryIndex index.php

+ create FCGIWrapper

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

add these line:

#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=0
exec /usr/bin/php-cgi

change permission

chmod 755 /var/www/cgi-bin/php-fcgi-daemon

+ add +ExecCGI on Options in your vhost / httpd.conf
some like this:


      Options -Indexes FollowSymLinks +ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all

 
:: Setup APC

vi /etc/php.d/apc.ini
# change on this line, like:
apc.shm_size=128M

 
:: Testing configure and restarting httpd

apachectl configtest

if everything is OK, then restarting Apache2

/etc/init.d/httpd restart

 
:: Links
+ Google
+ ThomasNetworks

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *