动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Cgi/Perl → 阅读文章

 如何安装FastCGI

作者来源: 
阅读 1789 人次 , 2006-2-16 14:43:00 

Intro

此文并非介绍FastCGI的好处,只是简单的介绍我的一次安装过程。
我的Env为 Win2000+SP4, Apache/2.0.50 (Win32) mod_perl/1.99_15-dev Perl/v5.8.4 mod_ssl/2.0.50 OpenSSL/0.9.7d PHP/4.3.7
$Apache_dir = "C:/Apache2"; $Perl_dir = "C:/usr";

Step by step

  1. http://www.fastcgi.com/dist/ 下载mod_fastcgi-2.4.2-AP20.dll(如果是Apache版本为1.3,下载mod_fastcgi-2.4.2-AP13.dll)。
  2. 遵从http://www.fastcgi.com/mod_fastcgi/INSTALL最下面的一段话:
    To install mod_fastcgi (built above or retrieved from 
    http://fastcgi.com/dist/):
    
      1. Copy the mod_fastcgi.dll to the Apache modules directory 
         (e.g. C:\Apache\modules)
    
      2. Edit the httpd configurion file (e.g. C:\Apache\conf\httpd.conf)
         and add a line like:
    
         LoadModule fastcgi_module modules/mod_fastcgi.dll
    
         Note that if there's a ClearModuleList directive after new entry,
         you'll have to either move the LoadModule after the ClearModuleList
         or add (have a look at how the other modules are handled):
    
         AddModule mod_fastcgi.c
    
      3. Edit the httpd configuration file(s) to enable your FastCGI
         application(s).  See docs/mod_fastcgi.html for details.
    
    简单翻译为
      1. 拷贝 mod_fastcgi.dll(我们下来的mod_fastcgi-2.4.2-AP*.dll,将其改名) 至Apache modules(模块)目录
         (如 C:\Apache\modules)
    
      2. 编辑httpd配置文件 (如 C:\Apache\conf\httpd.conf)
         然后增加如下一行:
    
         LoadModule fastcgi_module modules/mod_fastcgi.dll
    
         注意如果在此句以后出现 ClearModuleList 指示/directive,你必须要么移动LoadModule到ClearModuleList下面或增加(参考其他handled模块):
    
         AddModule mod_fastcgi.c
    
      3. 编辑httpd配置文件去启动你的FastCGI程序。更详细的请参考 docs/mod_fastcgi.html
    
  3. visit http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html, 参考此文档在httpd.conf里增加:
    
    <Directory "E:/Fayland/fcgi-bin">
    	SetHandler fastcgi-script
    	AddHandler fastcgi-script fcg fcgi fpl
    	Options +ExecCGI
    </Directory>
    
  4. 不要下载FCGI.pm-0.64-win32-x86.zip,可以cpan或ppm FCGI安装FCGI.pm和相关文件。
  5. 测试代码:(E:\Fayland\fcgi-bin\test.fpl)
    #!/usr/bin/perl
    use FCGI;
    use strict;
    
    my $count = 0;
    my $request = FCGI::Request();
    
    while($request->Accept() >= 0) {
    	$count++;
    	print "Content-type:text/html\n\n";
    	print "total request $count";
    }
    
    visit: http://localhost/fcgi-bin/test.fpl.

Refer

  
 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:如何将Perl代码着色
· 下一篇:快速开始Perl XML:接口篇
· CGI教学:CGI常用环境变量
· CGI教程(3)
· perl实例分析教程之七
· 跟我学Perl(7)
· CGI教程(6)


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077