Configure Apache + FastCGI (mod_fcgid) + PHP on RHEL5.3 (Tikanga)

Source: Internet
Author: User
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]

  1. LoadModule fcgid_module modules/mod_fcgid.so
  2. Include conf. d/php-fcgid.conf

B. Create a php-fcgid.conf under the/opt/httpd/conf. d directory.

[Xhtml]

  1. <IfModuleFcgid_module>
  2. # FcgidMaxRequestsPerProcess shoshould be<= PHP_FCGI_MAX_REQUESTS
  3. # The example PHP wrapper script overrides the default PHP setting.
  4. FcgidMaxRequestsPerProcess 10000
  5. # Uncomment the following line if cgi. fix_pathinfo is set to 1 in
  6. # Php. ini:
  7. FcgidFixPathinfo 1
  8. # Define a new handler "php-fcgi" for ". php" files, plus the action that must follow
  9. AddHandler php-fcgi. php
  10. Action php-fcgi/cgi-bin/php. fcgi
  11. IfModule>

 

C. Create php. fcgi in the/opt/cgi-bin directory (note that the permission to modify this file is 755)

[Xhtml]

  1. #! /Bin/bash
  2. # Path to php. ini
  3. PHPRC=/Usr/local/lib
  4. ### Set PATH ###
  5. PHP_CGI=/Opt/bin/php-cgi
  6. PHP_FCGI_CHILDREN=0
  7. PHP_FCGI_MAX_REQUESTS=1000
  8. ### No editing below ###
  9. Export PHPRC
  10. Export PHP_FCGI_CHILDREN
  11. Export PHP_FCGI_MAX_REQUESTS
  12. 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]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.