首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读1922次
cgi perl1初步安装运行

简直无法,刚刚弄了PHP,马马虎虎作了一个DEMO,发现又要在人家一个CGI的程序上修改,赶紧找CGI资料。网上国内大部分都是PERL的,按照步骤操作了一把。

O:\php\Apache Group\Apache2\cgi-bin下面有了一个DEMO:printenv

#!O:/php/perl/bin/Perl.exe
##!c:/perl/bin/Perl.exe
##
##  printenv -- demo CGI program which just prints its environment
## www.shengfang.org

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{ $var };
    $val =~ s|\n|\\n|g; www.shengfang.org
    $val =~ s|"|\\"|g;
    print "${ var }=\"${ val }\"\n";
} www.shengfang.org

抄了一个例子

#!O:/php/perl/bin/Perl.exe
print "Content-Type: text/plain\n\n";

print "这是CGI的环境变量\n";
foreach $key(keys %ENV){
print("$key:$ENV{ $key }\n");
}

我修改了O:\php\Apache Group\Apache2\conf  httpd.conf

LoadModule cgi_module modules/mod_cgi.so

ScriptAlias /cgi-bin/ "O:/php/Apache Group/Apache2/cgi-bin/"

#
# "O:/php/Apache Group/Apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "O:/php/Apache Group/Apache2/cgi-bin">
    AllowOverride All
    Options all
    Order allow,deny
    Allow from all
</Directory> www.shengfang.org

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
AddHandler cgi-script .cgi .pl

运行,基本OK了,第一次不知道是不是修改代码的原因,总是报告 www.shengfang.org

Internal Server Error www.shengfang.org
The server encountered an internal error or misconfiguration and was unable to complete your request. www.shengfang.org

Please contact the server administrator, yippee_sk at yahoo dot com.cn and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

--------------------------------------------------------------------------------

Apache/2.0.54 (Win32) PHP/4.3.10 Server at 127.0.0.1 Port 80

Forbidden www.shengfang.org
You don't have permission to access /cgi-bin/ on this server.
--------------------------------------------------------------------------------
Apache/2.0.54 (Win32) PHP/4.3.10 Server at 127.0.0.1 Port 80
http://127.0.0.1/cgi-bin/ www.shengfang.org

http://www.20cn.net/ns/wz/soft/data/20040225014342.htm
FastCGI、ModPerl、PHP、普通CGI、SSI性能实测对比 (阅览 3182 次)
作者:NetDemon
email:netdemon at 20cn dot com
http://www.20cn.net/
本文版权属20CN网络安全小组所有,允许转载,但需保持文章的完整性并注明出处

阅读文章之前,我希望您先搞清楚一个概念,不要把CGI和perl语言联系在一起。

CGI英文全称是 Common Gateway Interface,通常翻译为共同网关接口,是HTTP服务器与机器上的其他程序进行通信的一个接口。这个“其他程序”可以使用任何计算机语言来编写,它通过CGI这个接口从HTTP服务器取得输入,然后把运行的结果又通过CGI这个接口交给HTTP服务器,而HTTP服务器把这个结果送给浏览器。

perl是一种解释形的计算机语言,具有强大且方便的文本处理能力,被誉为计算机的“瑞士军刀”,它被除了Windows之外的几乎所有的其他服务器操作系统所默认安装。BSD UINX 上有些系统命令就是用perl编写。如whereis which adduser catman等。因为HTTP动态页面主要就是文本的处理所以perl也就非常的适合来编写这个“其他程序”。这也就造成了一个很好笑的事实,上google搜索CGI,出来的国内网站基本都是在谈perl,在很多人眼里,CGI成了一种语言,成了perl的代名词。

根据他的测试,好像PERL效率还是不怎么样?


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/cgiperl1inst.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1126512876

2005年9月12日16:14星期一  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 18||用户: 2562 [列表]
今日:2050||到访:2671549
Rss:838410||评论:1584

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8