2014-03-25 11:40:01
来 源
IT技术网
Apache
本文介绍Apache服务器配置fcgid方式运行PHP程序,希望对于初学Apache服务器相关的朋友有帮助,更多Apache安装、配置、报错处理等资源请本站内搜索。
apache上php运行主要两种方式,一种是将php以apache的模块加载,另一种是运行单独的php-cgi进程,解析php。

php模块安装相应软件包即可,如debian下apt-get install libapache2-mod-php5。

fastcgi网上可以搜索到fastcgi和fcgid两个模块,较适合使用的为fcgid,在apache项目的页面上有单独的链接页面。debian下运行apt-get install libapache2-mod-fcgid。

下面是其他相关的配置,来自apache项目上的在线文档:

----------

# FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS

# The example PHP wrapper script overrides the default PHP setting.

FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in

# php.ini:

# FcgidFixPathinfo 1

Alias /phpapp/ /usr/local/phpapp/

<Location /phpapp/>

AddHandler fcgid-script .php

Options +ExecCGI

FcgidWrapper /usr/local/bin/php-wrapper .php

# Customize the next two directives for your requirements.

Order allow,deny

Allow from all

</Location>

----------

新建的/usr/local/bin/php-wrapper

----------

PHP wrapper script - /usr/local/bin/php-wrapper #!/bin/sh

# Set desired PHP_FCGI_* environment variables.

# Example:

# PHP FastCGI processes exit after 500 requests by default.

PHP_FCGI_MAX_REQUESTS=10000

export PHP_FCGI_MAX_REQUESTS

# Replace with the path to your FastCGI-enabled PHP executable

exec /usr/local/bin/php-cgi

----------

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。