Script displays in dos window, not browser

Discussion in 'Perl Misc' started by Joe Burnett, Aug 10, 2003.

  1. Joe Burnett

    Joe Burnett Guest

    Hello,

    I am trying to run a trivial perl script, but the results either get
    displayed in a dos window,
    or the source code gets displayed in a browser. The former happens when I
    open the script
    in IE with a pl extension. The latter happens if I open the script with a
    cgi extension. Both
    scripts reside in "C:\Program Files\Apache Group\Apache2\cgi-bin".
    Obviously, I have an
    apache server (the service is started, as well as two apache.exe processes).
    I have ActiveState
    perl installed. Here is the script:

    #!C:\Perl\bin\perl.exe

    print "Content-type: text/html\n\n";

    print "<html>\n<head><title>First CGI</title></head>\n";

    print "<body><h1>\n";

    print "Hello world!!";

    print "</h1>\n </body>\n</html>\n";

    I have been looking in the news groups for two days to no avail.

    Thanks,

    Joe
    Joe Burnett, Aug 10, 2003
    #1
    1. Advertising

  2. Joe Burnett wrote:
    > I am trying to run a trivial perl script, but the results either get
    > displayed in a dos window,


    Well, then apparently the Perl script works perfectly fine: it prints
    exactly what it is supposed to print.

    > or the source code gets displayed in a browser.
    > I have an apache server

    [...]
    > I have been looking in the news groups for two days to no avail.


    Doesn't surprise me. You are looking the wrong place.
    You should check out a NG that actually deals with Apache to find out how to
    configure Apache.

    jue
    Jürgen Exner, Aug 10, 2003
    #2
    1. Advertising

  3. "Joe Burnett" <> wrote in message
    news:UyAZa.116059$uu5.17089@sccrnsc04...
    > Gregory, thanks for the reply.
    > > Looking for two days? Where? If you spent 2 days reading the Apache
    > > documentation you should know it by heart.

    > Well, off and on for two days. Even if I did know the Apache stuff by

    heart,
    > I don't think it would help. I implemented the changes you suggested and

    the
    > behavio(u)r did not change. Still get either a DOS window (.pl) or the
    > source
    > code displayed in IE (.cgi).
    >
    > Do you have any other suggestions? Is the fact that I have a Windows XP

    Pro
    > as my server, but have specified DHCP to get the IP address (which by the
    > way
    > matches the address in my httpd.conf) creating the problem?
    >
    > Thanks again,
    >
    > Joe
    >


    Step number 1 to to make sure you can access regular html.
    eg http://www.yoursite.com/mypage.html
    If you can't even do that then you need to sort out DNS issues.

    When you have that working you can try something like
    http://www.yoursite.com/cgi/bin/script.cgi


    gtoomey
    Gregory Toomey, Aug 11, 2003
    #3
  4. Joe Burnett

    Islaw Guest

    Islaw, Aug 11, 2003
    #4
  5. Joe Burnett

    Joe Burnett Guest

    Thanks, Alan, Gregory and Jürgen,

    I tried your suggestions to no avail on my home based Windows XP system. I
    have located a linux based
    web server that runs both myscript.cgi and myscript.pl with the expected
    results showing up in my browser.
    I am able to develope now. I'll get back to my home system later this week.

    Thanks again,

    Joe Burnett

    "Alan C." <> wrote in message
    news:...
    > "Joe Burnett" <> wrote in message
    > news:KluZa.113785$Ho3.14438@sccrnsc03...
    > > Hello,
    > >
    > > I am trying to run a trivial perl script, but the results either get
    > > displayed in a dos window,
    > > or the source code gets displayed in a browser. The former happens when

    I
    > > open the script
    > > in IE with a pl extension. The latter happens if I open the script with

    a
    > > cgi extension.

    >
    > But how is the open accomplished? is it like do you enter into the

    address
    > bar of the browser something near/like:
    >
    > http://localhost/cgi-bin/myscript.cgi
    >
    > >Both
    > > scripts reside in "C:\Program Files\Apache Group\Apache2\cgi-bin".

    >
    > File location looks ok. What happen if U do
    > localhost/cgi-bin/scriptname.cgi as I mentioned further above
    >
    > --
    >
    > http://perl.about.com/cs/beginningperl/
    >
    > http://perl.about.com/cs/intermediateperl/
    >
    > very near those above two is also some cgi info. a "Perl 101 class" which
    > focuses on Perl cgi & web server a few basics
    >
    > --
    > Alan.
    >
    >
    >
    Joe Burnett, Aug 12, 2003
    #5
  6. Joe Burnett

    Joe Burnett Guest

    Thanks, Alan, Gregory and Jürgen,

    I tried your suggestions to no avail on my home based Windows XP system. I
    have located a linux based
    web server that runs both myscript.cgi and myscript.pl with the expected
    results showing up in my browser.
    I am able to develope now. I'll get back to my home system later this week.

    Thanks again,

    Joe Burnett

    "Alan C." <> wrote in message
    news:...
    > "Joe Burnett" <> wrote in message
    > news:KluZa.113785$Ho3.14438@sccrnsc03...
    > > Hello,
    > >
    > > I am trying to run a trivial perl script, but the results either get
    > > displayed in a dos window,
    > > or the source code gets displayed in a browser. The former happens when

    I
    > > open the script
    > > in IE with a pl extension. The latter happens if I open the script with

    a
    > > cgi extension.

    >
    > But how is the open accomplished? is it like do you enter into the

    address
    > bar of the browser something near/like:
    >
    > http://localhost/cgi-bin/myscript.cgi
    >
    > >Both
    > > scripts reside in "C:\Program Files\Apache Group\Apache2\cgi-bin".

    >
    > File location looks ok. What happen if U do
    > localhost/cgi-bin/scriptname.cgi as I mentioned further above
    >
    > --
    >
    > http://perl.about.com/cs/beginningperl/
    >
    > http://perl.about.com/cs/intermediateperl/
    >
    > very near those above two is also some cgi info. a "Perl 101 class" which
    > focuses on Perl cgi & web server a few basics
    >
    > --
    > Alan.
    >
    >
    >
    Joe Burnett, Aug 12, 2003
    #6
  7. Joe Burnett

    Joe Burnett Guest

    Thanks, Alan, Gregory and Jürgen,

    I tried your suggestions to no avail on my home based Windows XP system. I
    have located a linux based
    web server that runs both myscript.cgi and myscript.pl with the expected
    results showing up in my browser.
    I am able to develope now. I'll get back to my home system later this week.

    Thanks again,

    Joe Burnett

    "Alan C." <> wrote in message
    news:...
    > "Joe Burnett" <> wrote in message
    > news:KluZa.113785$Ho3.14438@sccrnsc03...
    > > Hello,
    > >
    > > I am trying to run a trivial perl script, but the results either get
    > > displayed in a dos window,
    > > or the source code gets displayed in a browser. The former happens when

    I
    > > open the script
    > > in IE with a pl extension. The latter happens if I open the script with

    a
    > > cgi extension.

    >
    > But how is the open accomplished? is it like do you enter into the

    address
    > bar of the browser something near/like:
    >
    > http://localhost/cgi-bin/myscript.cgi
    >
    > >Both
    > > scripts reside in "C:\Program Files\Apache Group\Apache2\cgi-bin".

    >
    > File location looks ok. What happen if U do
    > localhost/cgi-bin/scriptname.cgi as I mentioned further above
    >
    > --
    >
    > http://perl.about.com/cs/beginningperl/
    >
    > http://perl.about.com/cs/intermediateperl/
    >
    > very near those above two is also some cgi info. a "Perl 101 class" which
    > focuses on Perl cgi & web server a few basics
    >
    > --
    > Alan.
    >
    >
    >
    Joe Burnett, Aug 12, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chumley Walrus
    Replies:
    1
    Views:
    12,160
    =?Utf-8?B?QnJpYW4gQnJvd24=?=
    Dec 16, 2004
  2. Ben Fairbank
    Replies:
    2
    Views:
    5,403
  3. john san
    Replies:
    19
    Views:
    728
    Diez B. Roggisch
    Feb 18, 2005
  4. tomhr
    Replies:
    27
    Views:
    1,400
    Mike Wahler
    Jan 12, 2006
  5. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    265
    Michele Dondi
    Jan 22, 2004
Loading...

Share This Page