RE: [users@httpd] Calling .pl file with Apache, Windows XP, file1.pl works, file2.pl doesn't

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you simply mixed up the order of method calls from CGI.pm

Your script needs to write the HTTP header first.
That's why the "print header" must come before
"print start_html".

If you are using the methods from CGI.pm
(which is always preferable)
then you can safely ignore worrying about formatting 
your own HTTP header.
So ommit the Content-type line.

Actually, you can easily verify that CGI.pm is 
formatting the propper header for you.
Try this at the shell (or windows cmd.exe)


# perl -MCGI -le '$cgi=CGI->new;print
$cgi->header,$cgi->start_html'
Content-Type: text/html; charset=ISO-8859-1

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; lang="en-US"
xml:lang="en-US"><head><title>Untitled Document<
/title>
</head><body>



> -----Original Message-----
> From: Mary Anderson [mailto:mfanderson@xxxxxxxxxxx]
> Sent: Wednesday, February 22, 2006 8:38 PM
> To: users@xxxxxxxxxxxxxxxx
> Subject: [users@httpd] Calling .pl file with Apache, Windows
XP,
> file1.pl works, file2.pl doesn't
> 
> 
> 
> Hi all,
>    I can call helloWorld, but not SampleEntry.pl.
SampleEntry.pl was
> working with my newly configured apache just fine last night.
But I 
> somehow lost the configuration and have tried to reconstruct
it.
>     I think it may be a Windows oddity.  Both helloWorld and 
> SampleEntry.pl are known to be PL files by the operating 
> system -- both 
> come up with the little lizard icon and are described as PL 
> files.  But 
> helloWorld is not displaying the .pl extension, and 
> SampleEntry is.  (I 
> forced it to while trying to get this to work!)
> 
> http.conf
> 
>      LoadModule cgi_module modules/mod_cgi.so
> 
>      <Directory />
>          Options FollowSymLinks ExecCGI
>          AllowOverride None
>      </Directory>
> 
>      <Directory "C:/Program Files/Apache
Group/Apache2/cgi-bin">
>          AllowOverride None
>          Options FollowSymLinks ExecCGI
>          Order allow,deny
>          Allow from all
>      </Directory>
>      AddHandler cgi-script .cgi .pl 
>      ScriptAlias /cgi-bin/ "C:/Program Files/Apache
Group/Apache2/cgi-
> bin/" 
> 
> helloWorld 
> 
>      #!C:/perl/bin/perl.exe
>      print "Content-type:text/html\n\n"
> 
>      use CGI "standard";
> 
>      print start_html;
>      print header;
>      print "Hello, world!";
>      print hr;
>      print end_html
> 
> SampleEntry.pl
> 
>      #!C:\perl\bin\perl.exe
>      print "Content-type:text/html\n\n";#I really don't want 
> this line, 
> but it seemed necessary to run the program.
> 
>      use strict;
>      use CGI qw/:standard :html3/;
>      use CGI::Carp('fatalsToBrowser', 'warningsToBrowser');
>      print start_html;
>      print header;
> 
>
-----------------------------------------------------------------
----
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>    "   from the digest:
users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux