配置apache運行Perl CGI程式的方法詳解

來源:互聯網
上載者:User

關於apache與CGI在這裡就不解釋了.
1、apache下載地址:http://www.apache.org,下面以2.0.63為例介紹運行CGI程式的配置。
2、下載Windows下的Perl解譯器ActivePerl,官方網站:http://www.activestate.com/,最新版本ActivePerl-    5.10.0.1003,假設安裝路徑為c:Perl。

3、修改apache的設定檔httpd.conf:

 代碼如下 複製代碼
<Directory "D:/Apache Group/Apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
#AddHandler cgi-script .cgi
改為:
<Directory "D:/Apache Group/Apache2/cgi-bin">
    AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
AddHandler cgi-script .cgi .pl

4、編寫perl指令碼程式hello.pl

 代碼如下 複製代碼
#!C:Perlbinperl.exe
print "content-type: text/html","nn";
print "<HTML>","n";
print "<HEAD>","n";
print "<TITLE>Perl</TITLE>","n";
print "</HEAD>","n";
print "<BODY>","n";
print "<H1>Hello World</H1>","n";
print "</BODY>","n";
print "</HTML>","n";

將程式拷貝到apache安裝目錄下cgi-bin檔案夾下.
5、啟動apache伺服器,開啟瀏覽器,輸入http://localhost/cgi-bin/hello.pl

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.