Apache Fastcgi

本篇將實作 Apache 載入Fastcgi 模組跑php

準備

下載:http://www.fastcgi.com/drupal/

安裝

1
yum install libtool httpd-devel apr-devel apr
1
2
3
4
5
 tar -zxvf mod_fastcgi-2.4.6.tar.gz
 cd mod_fastcgi-2.4.6/
 cp Makefile.AP2 Makefile
 make top_dir=/usr/lib64/httpd
 make install top_dir=/usr/lib64/httpd

查看log

1
2
cat /var/log/httpd/error_log
FastCGI: process manager initialized (pid 6221)

建立php.fcgi script

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
# Shell Script To Run PHP5 using mod_fastcgi under Apache 2.x
# Tested under Red Hat Enterprise Linux / CentOS 5.x
### Set PATH ###
PHP_CGI=/usr/bin/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
### no editing below ###
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI
1
chmod +x /var/www/cgi-bin/php.fcgi

修改htttpd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
vim /etc/httpd/conf/httpd.conf
# 加入這行
LoadModule fastcgi_module modules/mod_fastcgi.so
 
<Directory "/var/www/html">
	Options -Indexes FollowSymLinks +ExecCGI
	AllowOverride AuthConfig FileInfo
	AddHandler php5-fastcgi .php
	Action php5-fastcgi /cgi-bin/php.fcgi
	DirectoryIndex index.php index.html
	Order allow,deny
	Allow from all
</Directory>

phpinfo

info
fastcgi

參考資料

Related Posts with Thumbnails

隨選文章

發表迴響

您的電子郵件位址並不會被公開。 必要欄位標記為 *

*

您可以使用這些 HTML 標籤與屬性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>