Help running PERL scripts in browser - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help running PERL scripts in browser

Ok I have my Apache server running and I have currently PHP set up working fine with it.

I was able to successfully install Perl but I dont know how to run the sripts! I am not able to find any help from the CD that I used to install the software. With PHP I made changes to the httpd configuration file that is part of Apache and I am thinking something similar has to be done with Perl but I donmt know what.

In short when I want to run test.pl I do this: http://localhost/cgi-bin/test.pl but I get and internal server error.

I have the test.pl file in the cgi-gin folder that I created in the htdocs file in the Apache director where I have all other PHP scripts.

Help would be appreciated!

Thanks.

Comments

  • ITAITA Posts: 463Member
    Can't remember exactly (unsure) as to how to do this but I have a suggestion anyway. Remember when you set PHP and you had to specify that you wanted the php file executed by apache (in the config file). Why don't you try and do the same thing for Perl but simply change the extensions?

    I'm not sure if this will work but you could try it anyway.

    What sort of error messages are you receiving?

    I found this:

    You must next configure Apache to recognize Perl. This is done by editing the Apache configuration file. If you installed Apache using the default installation (the Apache MSI file) then the Apache configuration files are located at:

    X:Program FilesApache GroupApache2conf

    where X: is the system drive on your system.

    #

    Start notepad and open the file:

    X:Program FilesApache GroupApache2confhttpd.conf

    #

    In Notepad, click Edit and choose Find.

    #

    In the Find menu type the word options and click OK.

    #

    You should see some lines of text that looks like:


    Options FollowSymLinks
    ...


    #

    After the word FollowSymlinks type ExecCGI. The line should now read:


    Options FollowSymLinks ExecCGI
    ...

    #

    Save this file from Notepad.

    #

    Open a command window by clicking Start, typing the letter R, and typing CMD and pressing Enter.

    #

    In the Command window, type:

    NET STOP APACHE2 & NET START APACHE2

    this will stop and restart the Apache2 service.

    #

    To test CGI, open Notepad and type the following lines:

    #! /usr/bin/perl
    print "Content-type:text/html

    ";
    print "hello world";

    #

    Save this program in the folder X:ApacheWebcgi-bin with the name hello.cgi.

    #

    Create a new file in Notepad that has the following lines of text:









    #

    Save this file in the folder X:ApacheWeb with the name testperl.html

    #

    Start a browser and type the command:

    http://localhost/testperl.html

    #

    You should see a web page with a single button. When you click this button you should see the "Hello World" message.

    Notice the section on configuring Apache to recognise the extension.

    Or read the documentation about CGI and perl!
    http://httpd.apache.org/docs-2.0/


    Jonathan seems to be the perl guru round here - PM him.

    Hope some of this helps,

    ITA

    "Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"

Sign In or Register to comment.