Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm running a couple of search scripts on an Apache server and I can not get the pages to load properly in Netscape. Netscape wants to save the document or spawn Wordpad to view the page.
I've tried these:

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

2. use CGI qw/:standard/;
print header;

3. Printing the content-type in META tags

4. $r->content_type('text/html');

Please help!

diffenc@swosu.edu

Scripts are located at:

www.swosu.edu/util/swosufac.pl
www.swosu.edu/util/swosustd.pl
  • Comment on Perl script not opening in Netscape properly

Replies are listed 'Best First'.
Re: Perl script not opening in Netscape properly
by Fastolfe (Vicar) on Jan 22, 2001 at 21:23 UTC
    Ugh.. This question was corrected/duplicated. My response from the other thread:
    These scripts do not seem to be printing out any HTTP headers at all. The first thing I see is a <HEAD> tag. No server headers, no valid HTTP/1.0 response. The directory cgi-perl leads me to believe these scripts are being run under mod_perl/Apache::Session. I'm wondering if your code is causing problems in this respect?
Re: Perl script not opening in Netscape properly
by arturo (Vicar) on Jan 22, 2001 at 20:44 UTC

    Maybe you haven't configured Apache correctly to *execute* .pl scripts it finds in that directory. Check your Apache configuration to see whether you have Options +ExecCGI on for that directory (or location).

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

      To be sure wether your apache is well configured, open this file your netscape is trying to save and see what's in there. If there's your source code, your apache is misconfigured. If it shows what should appear in the browser, then your apache is ok... Anyway, this may give you a clue...
      scripts are actually located in the /home/bin directory on the server (default) - as far as we can tell, the config looks fine for that
Re: Perl script not opening in Netscape properly
by hotyopa (Scribe) on Jan 23, 2001 at 03:00 UTC
    Have you got the scripts in the CGI-BIN with execute permission?

    *~-}hotyopa{-~*

Re: Perl script not opening in Netscape properly
by mrmick (Curate) on Jan 22, 2001 at 20:31 UTC
    I would take a look at the Netscape client. Netscape is trying to associate a file type or mime type with an application.

    Mick
      I've tried that too, it still tries to open in an external application.

      Asks what program to open application/x-perl.

      I've tried multiple http header calls, and I am pretty sure everything is correct in the Apache server settings
        We're getting off the topic of Perl but try another browser to see what happens...

        Mick