I. Details about the software version used: Apache (apache2.2.15) ApacheFastCGImodule (mod_fcgid2.3.6) PHP5.3.3 (php-cgi: // www.linuxidc.com/linux/2012-02/53421.htmin rhel5
1. The detailed version information of the software used is as follows:
Apache (apache 2.2.15)
Apache FastCGI module (mod_fcgid 2.3.6)
PHP 5.3.3 (php-cgi)
Related reading:
Build PHP + Memcached http://www.linuxidc.com/Linux/2012-02/53421.htm in RHEL 5.4 (Tikanga)
Build Git http://www.linuxidc.com/Linux/2012-02/53420.htm at RHEL 5.3 (Tikanga)
Configure Apache + FastCGI (mod_fastcgi) + PHP http://www.linuxidc.com/Linux/2012-02/53419.htm on RHEL 5.3 (Tikanga)
2. Detailed configuration steps:
(The premise of the following steps is that Apache and PHP (php-cgi) have been installed)
1. Install the mod_fcgid module.
1 ):
Http://httpd.apache.org/download.cgi#mod_fcgid
2) Compile and install from source code
[Root@www.linuxidc.com] # whereis apxs
Apxs:/opt/httpd/bin/apxs
[Root@www.linuxidc.com mod_fcgid-2.3.6] # APXS =/opt/httpd/bin/apxs./configure. apxs
Root@www.linuxidc.com mod_fcgid-2.3.6 # make
[Root@www.linuxidc.com mod_fcgid-2.3.6] # make install
(Use updatedb to manually refresh the locate database and use locate mod_fcgid.so to check whether mod_fcgid is successfully installed .)
2. Configure Apache
1) Search for the path of the binary file php-cgi (here I use to compile and install PHP 5.3.3 from the source code under the/opt directory, readers can use locate php-cgi to find it .)
/Opt/bin/php-cgi
2) modify the php. ini used by php-cgi.
Cgi. fix_pathinfo = 1
3) modify the Apache configuration file/opt/httpd/conf/httpd. conf.
A. Add the following two rows at the appropriate position:
[Xhtml]
- LoadModule fcgid_module modules/mod_fcgid.so
- Include conf. d/php-fcgid.conf
B. Create a php-fcgid.conf under the/opt/httpd/conf. d directory.
[Xhtml]
- <IfModuleFcgid_module>
- # FcgidMaxRequestsPerProcess shoshould 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
- # Define a new handler "php-fcgi" for ". php" files, plus the action that must follow
- AddHandler php-fcgi. php
- Action php-fcgi/cgi-bin/php. fcgi
- IfModule>
C. Create php. fcgi in the/opt/cgi-bin directory (note that the permission to modify this file is 755)
[Xhtml]
- #! /Bin/bash
- # Path to php. ini
- PHPRC=/Usr/local/lib
- ### Set PATH ###
- PHP_CGI=/Opt/bin/php-cgi
- PHP_FCGI_CHILDREN=0
- PHP_FCGI_MAX_REQUESTS=1000
- ### No editing below ###
- Export PHPRC
- Export PHP_FCGI_CHILDREN
- Export PHP_FCGI_MAX_REQUESTS
- Exec $ PHP_CGI
D. Check whether the configuration syntax is correct, and then restart Apache with apachectl
[Root@www.linuxidc.com www] #/opt/httpd/bin/apachectl configtest
Syntax OK
[Root@www.linuxidc.com www] #/opt/httpd/bin/apachectl restart
E. Create config. inc. php In the/opt/httpd/www directory and access it through a browser. (If the configuration is correct, the value of _ SERVER ["SERVER_SOFTWARE"] in the PHP Variables column is Apache/2.2.15 (Unix) mod_fcgid/2.3.6)
[Php]
-