[Xitami] Linux 2.4.19 + Perl 5.7.0 & CGI

Rajesh Deshpande xitami@lists.xitami.org
Sun, 25 Aug 2002 17:53:50 +0530


This is a multi-part message in MIME format.

------=_NextPartTM-000-27952240-ef05-4f12-873a-7cea09701541
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0006_01C24C60.5E96AEA0"

------=_NextPart_000_0006_01C24C60.5E96AEA0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

OK. Got it working through Localhost setup using /home/cgi-bin path.

But what I want to do is, point the localhost to my actual =
/mnt/hdc1/webpages and /mnt/hdc1/cgi-bin directory and access cgi =
scripts under it.

I tried it by defining "127.0.0.1    hexa-tech.localnet    hexa-tech" =
entry in /etc/hosts file, and
under Xitami Web-Admin, Defaults:Vhosts, I defined "127.0.0.1    =
hexa-tech.cfg". Also generated hexa-tech.cfg giving all the required =
paths for webpages and cgi-bin.

This setup correctly accesses my webpage directory, but fails to execute =
CGI scripts from /mnt/hdc1/cg-bin giving the error 500 as explained =
before.

Is it possible to set up such a scenario? If yes, how? Please advice.

Thanks & Regards,
Rajesh Deshpande.

----- Original Message -----=20
  From: Rajesh Deshpande=20
  To: Xitami Webserver=20
  Sent: Sunday, August 25, 2002 1:43 PM
  Subject: [Xitami] Linux 2.4.19 + Perl 5.7.0 & CGI


  Recently I downloaded & installed Xitami Webserver on my Linux =
2.4.19/KDE 3.0 (reiserFS) machine.
  I am trying out CGI scripts but always get :

  Error 500 : internal error=20
  can not create CGI process - program not found.

  My setup is as follows:
  HTML dir : /mnt/hdc1/webpages
  Cgi-bin dir : /mnt/hdc1/cgi-bin
  (Both directories on WIN95 (vfat) partitions)

  My web pages are getting loaded perfectly. But CGI scripts gives error =
500.
  Xitami documentation/FAQ says that error 500 is mostly because of =
wrong header or syntax error.

  Following is the script "server_info.cgi" in cgi-bin directory, I am =
trying to execute:
  #----------------------------------------------
  #!/usr/bin/perl

  use strict;
  use CGI;

  print <<END_OF_HTML;
  Content-type: text/html

  <HTML>
  <HEAD>
      <TITLE>About This Server</TITLE>
  </HEAD>
  <BODY>
      <H1>Server Information</H1>
      <HR>
      <PRE>
      Server Name       : $ENV{SERVER_NAME}
      Listening on port : $ENV{SERVER_PORT}
      Server Software   : $ENV{SERVER_SOFTWARE}
      Server Protocol   : $ENV{SERVER_PROTOCOL}
      CGI Version       : $ENV{GATEWAY_INTERFACE}
      </PRE>
      <HR>
  </BODY>
  </HTML>
  END_OF_HTML
  #-----------------------------------------------

  I have perl 5.7.0 (perl+base+devel+.....many more libs) installed on =
my system and /usr/bin is where perl can be found.
  I have enabled CGI and SSI on my server and made my scripts executable =
using chmod.

  I could compiled my script using
  #perl -wcT server_info.cgi
  which gave "syntax OK" message.

  The so called magic first line "#!perl" also does not work. It simply =
lists the contents of the file.
  I tried to rename the script with .pl extension to overcome the =
problem but with no result.
  Also tried to set filters for .cgi and .pl extensions with perl but =
that too did not work.

  Xitami's "testcgi?" programs work OK, but they all seem to be C =
programs, not perl scripts.

  Do I have to install any other perl libs specific to CGI on my system =
or I have missed out any settings?
  I would appreciate If anybody can help me out in getting started with =
CGI.

  Thanks & Regards,
  Rajesh Deshpande.


------=_NextPart_000_0006_01C24C60.5E96AEA0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4807.2300" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>OK. Got it working through Localhost =
setup using=20
/home/cgi-bin path.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>But what I want to do is, =
point&nbsp;the localhost=20
to my actual /mnt/hdc1/webpages and /mnt/hdc1/cgi-bin&nbsp;directory and =
access=20
cgi scripts&nbsp;under it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I tried it by defining =
"127.0.0.1&nbsp;&nbsp;&nbsp;=20
hexa-tech.localnet&nbsp;&nbsp;&nbsp; hexa-tech" entry in /etc/hosts =
file,=20
and</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>under Xitami Web-Admin, =
Defaults:Vhosts, I defined=20
"127.0.0.1&nbsp;&nbsp;&nbsp; hexa-tech.cfg". Also generated=20
hexa-tech.cfg&nbsp;giving all the required paths for webpages and=20
cgi-bin.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>This setup correctly accesses my =
webpage directory,=20
but fails to execute CGI scripts from /mnt/hdc1/cg-bin giving the error =
500 as=20
explained before.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Is it possible to set up such a =
scenario? If yes,=20
how? Please advice.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks &amp; Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Rajesh Deshpande.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Dradhx@eth.net href=3D"mailto:radhx@eth.net">Rajesh =
Deshpande</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DXitami@lists.xitami.org=20
  href=3D"mailto:Xitami@lists.xitami.org">Xitami Webserver</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, August 25, 2002 =
1:43=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Xitami] Linux 2.4.19 =
+ Perl=20
  5.7.0 &amp; CGI</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>Recently I downloaded &amp; installed =
Xitami=20
  Webserver on my Linux 2.4.19/KDE 3.0 (reiserFS) machine.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I am trying out CGI scripts but =
always get=20
  :</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><STRONG><FONT face=3DArial size=3D2>Error 500 : </FONT><FONT =
face=3DArial=20
  size=3D2>internal error </FONT></STRONG></DIV>
  <DIV><FONT face=3DArial size=3D2><STRONG>can not create CGI process - =
program not=20
  found.</STRONG></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><U>My&nbsp;setup is as =
follows</U>:</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2>HTML dir =
:=20
  /mnt/hdc1/webpages</DIV>
  <DIV>
  <DIV>
  <DIV><FONT face=3DArial size=3D2>Cgi-bin dir :=20
  /mnt/hdc1/cgi-bin</FONT></FONT></FONT><FONT face=3DArial=20
  size=3D2></FONT></DIV></DIV></DIV>
  <DIV><FONT face=3DArial size=3D2>(Both directories&nbsp;on&nbsp;WIN95=20
  (vfat)&nbsp;partitions)</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>My web pages are getting loaded =
perfectly. But=20
  CGI scripts gives error 500.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Xitami documentation/FAQ says that =
error 500 is=20
  mostly because of wrong header or syntax error.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Following is the script =
"server_info.cgi" in=20
  cgi-bin directory, I am trying to execute:</FONT></DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>#----------------------------------------------</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>#!/usr/bin/perl</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>use strict;<BR>use CGI;</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>print =
&lt;&lt;END_OF_HTML;<BR>Content-type:=20
  text/html</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>&lt;HTML&gt;<BR>&lt;HEAD&gt;<BR>&nbsp;&nbsp;&nbsp; =
&lt;TITLE&gt;About=20
  This=20
  =
Server&lt;/TITLE&gt;<BR>&lt;/HEAD&gt;<BR>&lt;BODY&gt;<BR>&nbsp;&nbsp;&nbs=
p;=20
  &lt;H1&gt;Server Information&lt;/H1&gt;<BR>&nbsp;&nbsp;&nbsp;=20
  &lt;HR&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;PRE&gt;<BR>&nbsp;&nbsp;&nbsp; =
Server=20
  Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :=20
  $ENV{SERVER_NAME}<BR>&nbsp;&nbsp;&nbsp; Listening on port :=20
  $ENV{SERVER_PORT}<BR>&nbsp;&nbsp;&nbsp; Server Software&nbsp;&nbsp; :=20
  $ENV{SERVER_SOFTWARE}<BR>&nbsp;&nbsp;&nbsp; Server =
Protocol&nbsp;&nbsp; :=20
  $ENV{SERVER_PROTOCOL}<BR>&nbsp;&nbsp;&nbsp; CGI=20
  Version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :=20
  $ENV{GATEWAY_INTERFACE}<BR>&nbsp;&nbsp;&nbsp;=20
  &lt;/PRE&gt;<BR>&nbsp;&nbsp;&nbsp;=20
  =
&lt;HR&gt;<BR>&lt;/BODY&gt;<BR>&lt;/HTML&gt;<BR>END_OF_HTML<BR>#---------=
--------------------------------------</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>I have perl 5.7.0 =
(perl+base+devel+.....many more=20
  libs) installed on my system and </FONT><FONT face=3DArial =
size=3D2>/usr/bin is=20
  where&nbsp;perl can be found.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I have enabled CGI and SSI on my =
server and made=20
  my scripts executable using chmod.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>I&nbsp;could compiled my script=20
using</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>#perl -wcT =
server_info.cgi</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>which gave "syntax OK" =
message.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>
  <DIV><FONT face=3DArial size=3D2>The so called magic&nbsp;first line =
"#!perl" also=20
  does not work. It simply lists the contents of the file.</FONT></DIV>
  <DIV>I&nbsp;tried to rename the script with .pl extension to overcome =
the=20
  problem but with no result.</FONT></DIV></DIV>
  <DIV><FONT face=3DArial size=3D2>Also tried to set filters for .cgi =
and .pl=20
  extensions&nbsp;with perl but that too did not work.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Xitami's "testcgi?" programs work OK, =
but they=20
  all seem to be C programs, not perl scripts.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Do I have to install any other perl =
libs specific=20
  to CGI on my system or I have missed out any settings?</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>I would appreciate If anybody can =
help me out in=20
  getting started with CGI.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>Thanks &amp; Regards,</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Rajesh=20
Deshpande.<BR></FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0006_01C24C60.5E96AEA0--


------=_NextPartTM-000-27952240-ef05-4f12-873a-7cea09701541--