Installing FastCGI in Unix/Linux is complicated. Now let's talk about FastCGI installation in Unix/Linux, Perl, and Apache server environments. FCGI modules in Apache: 1. download http://www.fastcgi.com/dist/mod_fastcgi.tar.gz2?decompress Apache to install FastCGI in Unix/Linux. Now let's talk about FastCGI installation in Unix/Linux, Perl, and Apache server environments.
FCGI modules in Apache:
1. download http://www.fastcgi.com/dist/mod_fastcgi.tar.gz
2. decompress the apache installation file. Decompress the fastcgi installation file to/src/modules/fas under apache.
Tcgi Directory
3. set Apache to add the mod_fastcgi module:
./Configure -- activate-module = src/modules/fastcgi/libfastcgi. a -- enabl
E-module = info -- enable-shared = info
4. compilation and installation
$ Make
$ Make install
5. check whether the compiled execution file contains the mod_fastcgi module:
$ Apacherunpath/httpd-l
Compiled-in modules:
Http_core.c
...
Mod_fastcgi.c
...
6. add relevant settings for using mod_fastcgi www.linuxidc.com
Edit httpd. conf and add AddHandler fastcgi-script. fcg. fpl.
Create the youwwwpath/fcgi-bin directory and set the/fcgi-bin/directory to indicate youwwwpath/fcgi-bin.
/Add ScriptAlias/fcgi-bin // usr/local/www/fcgi-bin/to httpd. conf/
7. check for syntax errors
$/Apachepath/apachectl configtest
Syntax OK -- System Display
8. reactivate the Apache server to make the new settings take effect:
$/Usr/local/apache/sbin/apachectl graceful
/Usr/local/apache/bin/apachectl graceful: httpd gracefully restarted
-- System Display
FCGI module of PERL:
1. First, we install the FastCGI module in Perl. The latest version in http://www.fastcgi.com
.
Latest: FCGI-0.56.tar.gz
2. download FCGI-0.45.tar.gz and unlock
$ Gunzip-c FCGI-0.56.tar.gz | tar xvf-
3. compilation and installation
$ Perl Makefile. PL
$ Make
$ Make install
4. test
$ Cp echo. fpl {directory where Fastcgi is located in your www}
$ Lynx {echo. fpl address in your www}
If it succeeds, the following results will be displayed:
FastCGI echo (Perl)
Request number 1
No data from standard input.
Request environment:
Apache/1.3.6 Server at localhost. localdomain Port 80
SERVER_SOFTWARE = Apache/1.3.6 (Unix) mod_fastcgi/2.2.2
UNIQUE_ID = N1VIbX8AAAEAAAQnKKo
More on its way... wait a few seconds
Initial environment:
Finally, we will give you an example of fastcgi programming:
#! /Usr/local/bin/perl
Use CGI: Fast;
My $ counter = 0;
While (my $ cgi = new CGI: Fast ){
Print ("Content-type: text/html ");
Print ("We have served $ counter requests ");
$ Counter ++;
}
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.