Koozali.org: home of the SME Server

CGI problems

Offline alext

  • ****
  • 91
  • +0/-0
CGI problems
« on: December 10, 2004, 04:37:38 PM »
I have set up 3 files to try to call CGI scripts on my new SME 6.0 server.
The index.htm is in the primary/html directory.
The test.cgi and test.htm files are in the primaryl/cgi-bin
When attempting to link to either of the two test files from index.htm I get "SEVERE INTERNAL SERVER error, (500)".
I have checked the first line in the script and it points correctly to the PERL interpreter.  
I have checked the PERL interpreter by running a simple "Hello world" script from the SME console.  
What am I doing wrong? Can anybody help please?

Below is are locations and rights of the 3 test files, the rights of the cgi-bin directory, followed by a listing of each file.

++++++++++++++++++++++++++++++++++++++++++++++++++++

/home/e-smith/files/primary/html/index.htm (-rwxr----- 0740)
/home/e-smith/files/primaryl/cgi-bin/test.cgi (-rwxr-x--x 0751)
/home/e-smith/files/primary/cgi-bin/test.htm (-rwxr----- 0740)

/home/e-smith/files/primary/cgi-bin (drwxr-s--- 2750)


index.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>Test Foundation</TITLE>
<META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>
<BODY BGCOLOR="#FFFFFF" MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="10" WIDTH="100%">
<TR>
<TD BGCOLOR="#290099" COLSPAN="2"><FONT COLOR="#F7E0B5"><H1>Test Foundation</H1></FONT></TD>
</TR>
<TR>
<TD BGCOLOR="#F7E0B5" WIDTH="15%">&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" WIDTH="85%">
<FONT COLOR="#000000"><H2>Leaders in Nothing</H2></FONT>

<a href="/cgi-bin/test.cgi">Test CGI</a><br>
<a href="/cgi-bin/test.htm">Test HTM</a><br>

</TD>
</TR>
</TABLE>
</BODY>
</HTML>


test.cgi

#!/usr/bin/perl
print "Hello World\n";
print "This is a test CGI\n";


test.htm

<HTML>
<HEAD>
<TITLE></TITLE>
<META name="robots" content="nofollow,noindex">
<META name="keywords" content="">
</HEAD>
<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>
<h1>This is TEST HTM</h1>
</BODY>
</HTML>
...

GoVeGeTa

CGI problems
« Reply #1 on: January 26, 2005, 02:03:48 PM »
I had a similar problem trying to execute cgi scripts from the primary ibays cgi-bin!

My workaround was to create a new ibay, with all permissions set all users of my sme box, with dynamic script execution (cgi, php, pl etc.......) and no password!

Drop your files into their respective dirs (html/cgi-bin) and test them!

It may seem lame to do it this way, but atleast I can guarantee that the cgi scripts will execute from this newly created ibays cgi-bin!

Offline alext

  • ****
  • 91
  • +0/-0
Found a fix
« Reply #2 on: April 01, 2005, 10:50:52 AM »
Just in case anybody is still interested...
I found a fix for my problem: I changed my TEST.CGI script.

The important change was on the first line where it says:

        #!/usr/bin/perl -w

The -w seems to do the trick. I don't know what the switch does but leave it out and it doesn't work.

The TEST.CGI listing is as follows:

#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print <<'ending_print_tag';
<html>
<head>
<title> a test CGI </title>
</head>
<body text="red" background="#000000">
<h2> A test CGI script </h2>
<em> Hello World </em>
<hr noshade>
Yet another Try
</body>
</html>
ending_print_tag
...

egerards

Re: Found a fix
« Reply #3 on: April 01, 2005, 11:18:16 AM »
Quote from: "alext"
The -w seems to do the trick. I don't know what the switch does but leave it out and it doesn't work.


# perl --help | grep "\-w"
  -w              enable many useful warnings (RECOMMENDED)