faqts : Computers : Programming : Languages : Perl : Installation and Setup

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 5 people (100%) answered Yes
Recently 5 of 5 people (100%) answered Yes

Entry

Perl: Run: Microsoft Windows: How to run Perl on Apache?

Feb 12th, 2005 17:03
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 13 February 2005 - 06:33 am -------------------

Perl: Run: Microsoft Windows: How to run Perl on Apache?

---

 1. Download and install Perl

 2. Run your Perl files

     1. Create your test page

        1. Create a file with the following text

--- cut here: begin --------------------------------------------------

#!<your path to your Perl executable program>
print "Content-type: text/html\n\n";
<your other Perl code>

--- cut here: end ----------------------------------------------------

e.g.

--- cut here: begin --------------------------------------------------

#!c:/perl/bin/perl.exe
print "Content-type: text/html\n\n";
print "hello world from Perl";

--- cut here: end ----------------------------------------------------

e.g.

--- cut here: begin --------------------------------------------------

#!c:/perl/bin/perl
print "Content-type: text/html\n\n";
print "hello world from Perl";

--- cut here: end ----------------------------------------------------

        2. Save it as e.g.

            test.pl

     2. Save your Perl pages in the default directory for cgi-bin in
        Apache

         <your apache directory>\cgi-bin\

        1. Save thus this test file as e.g.

          c:\program files\Apache Group\Apache2\cgi-bin\test.pl

     3. Open the pages in your browser with the URL

     <IP address of computer on which web server runs>\cgi-bin\<your 
Perl filename>

     or

     <URL of computer on which web server runs>\cgi-bin\<your Perl 
filename>

        1. when working on your local machine, type

            127.0.0.1\cgi-bin\<your Perl filename>

            e.g.

              127.0.0.1\cgi-bin\test.pl

            -- or --

            http://localhost\cgi-bin\<your Perl filename>

             e.g.

              http://localhost\cgi-bin\test.Perl

        2. when not working on your local machine, but against
           a remote computer, type

            <ip address of that computer>\cgi-bin\<your Perl filename>

            e.g.

              192.168.0.1\cgi-bin\test.Perl

            -- or --

            http://www.xxx.zzz\cgi-bin\<your Perl filename>

             e.g.

              http://www.knud.info\cgi-bin\test.Perl

        3. If you run this file it will show

--- cut here: begin --------------------------------------------------

hello world from Perl

--- cut here: end ----------------------------------------------------

---
---

Note:

You usually do not have to edit the Apache configuration file
httpd.conf

---
---

Troubleshooting:

If you get internal error 500:

Check the file

 <your apache directory>\logs\error.log

for possible error explanations.

---
---

Tested successfully on Microsoft Windows XP Professional,
running

Apache version 2.0

ActiveState Perl version 5.8.6

---
---

Internet: see also:

---

Operating system: Microsoft Windows: WAMP: Install: How install 
Apache, MySql, Perl or Perl? [LAMP]
http://www.faqts.com/knowledge_base/view.phtml/aid/33808/fid/868

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