Barb Konings wrote:

> I have checked my books, checked permissions, and am
> still having trouble.
> 
> Here is my code in a file named hello.pl. I have a
> link to this file off my web page to test it.
> (Maybe this part is now right?...)
> - - - - - - - - - - - - - - - - - - - - - -
> #!/usr/bin/perl
> 
> # hello.pl
> 
> print "Content-type: text/html\n\n";
> print <<END_OF_FILE;
> <HTML>
> <HEAD>
>    <TITLE>Hello</TITLE>
> </HEAD>
> <BODY>
>    <p>Hello, world!</p>
> </BODY>
> </HTML>
> 
> END_OF_FILE
> 
> - - - - - - - - - - - - - - - - - - - - - - - -
> When I have this file in the CGI-BIN directory,
> I get an internal server error. So I put it in
> with my HTML files, and this is now what I get
> in the browser.
> - - - - - - - - - - - - - - - - - - - - - - - -
> #!/usr/bin/perl # hello.pl print "Content-type:
> text/html\n\n"; print <
> Hello, world!
> 
> END_OF_FILE
> 
> - - - - - - - - - - - - - - - - - - - - - - - -
> I started with the permissions of both the CGI-Bin
> directory and the file at 755, then changed to 777.
> No luck.
> 
> I have tried with both a .pl and .cgi extension.
> 
> There is another .pl file in the CGI-BIN directory
> that works fine.  It is executed on clicking a submit
> button.
> 
> The first line of this file matches the first line of
> the file that works.
> 
> Apache Server - Red Hat 8


Barb, it sounds to me that possibly the Apache server is not configured 
correctly. The other .pl script is being sent form data from an existing 
form, but isn't being run DIRECTLY as a .cgi script viewed from the browser

Is the httpd.conf set to allow .cgi execution in userdirs ? This DOES need 
to be manually set on a Red Hat 8 default httpd.conf, in order to allow 
/home/$USER/public_html/cgi-bin/file.cgi to execute as a CGI script

You could try this. It's a bit more complex, but should yield some results. 
(oh, by the way, have you checked /var/log/httpd/access_log and 
/var/log/httpd/error_log during testing of the script to see what KIND of 
errors are showing up ?)

#!/usr/bin/perl 
use warnings;
use strict;
use CGI qw/:standard :html3 -no_xhtml/;

# report fatal errors to browser - check website error log for warnings!
use CGI::Carp qw(fatalsToBrowser set_message);
    BEGIN {
       sub handle_errors {
          my $msg = join( br(), @_);
          print header(), 
                start_html( "CGI/Perl Script Error" ),
                h2( "Eek!"),
                p( "I must be beta-testing some changes, so E-mail me, ", 
                   a({-href=>'mailto:[EMAIL PROTECTED]'}, "YOURNAMEHERE"), 
                   ", about this if it persists for very long.",
                 ), 
                hr(),
                p( "Got an error: $msg" ), 
                end_html();
      }
      set_message(\&handle_errors);
    };   

print header(), 
      start_html({-title=>"Hello"},),
        p("Hello, world!"),
      end_html();

# ps. it's MUCH easier to code html using CGI.pm's function oriented 
# interface. As you can see. :-) 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to