How to configure apache to run the Perl CGI program

Source: Internet
Author: User
Tags apache download perl interpreter perl script

Apache and CGI are not explained here.
1. apache download address: http://www.apache.org, the following uses 2.0.63 as an example to introduce the configuration of running CGI program.
2. Download the Perl interpreter ActivePerl in Windows. Official website: http://www.activestate.com/. the latest version is ActivePerl-5.10.0.1003. Assume that the installation path is c: Perl.

3. Modify the apache configuration file httpd. conf:

The code is as follows: Copy code
<Directory "D:/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options None
Order allow, deny
Allow from all
</Directory>
# AddHandler cgi-script. cgi
Changed:
<Directory "D:/Apache Group/Apache2/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow, deny
Allow from all
</Directory>
AddHandler cgi-script. cgi. pl

4. Write the perl script program hello. pl

The code is as follows: Copy code
#! 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 ";

Copy the program to the cgi-bin folder under the apache installation directory.
5. Start the apache server, open the browser, and enter http: // localhost/cgi-bin/hello. pl

 

Related Article

Contact Us

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.

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.