多语言展示
当前在线:1414今日阅读:103今日分享:49

解决apache不能运行CGI的方法

CGI这里简单的说下,就是很多网站都需要输入验证码,而在Apache的环境下没有开启CGI的话,网站的验证码是无法正常显示的,这里给出的方法适用于Apache版本:2.0.63,在Windows平台上使用。
工具/原料
1

Apache

2

ActivePerl脚本解释器

方法/步骤
1

修改apache的配置文件httpd.conf:    AllowOverride None    Options None    Order allow,deny    Allow from all#AddHandler cgi-script .cgi改为:    AllowOverride None    Options ExecCGI    Order allow,deny    Allow from allAddHandler cgi-script .cgi .pl

2

编写perl脚本程序hello.pl#!C:\Perl\bin\perl.exe(注意:这是PERL的安装路径)print 'content-type: text/html','\n\n';print '','\n';print '','\n';print 'Perl','\n';print '','\n';print '','\n';print '

Hello World

','\n';print '','\n';print '','\n';将程序拷贝到apache安装目录下cgi-bin文件夹下。

3

启动Apache服务器进行测试本地IE中输入:http://127.0.0.1/cgi-bin/hello.pl出现 Hello Word 字样即可正常运行CGI。

推荐信息