Koozali.org: home of the SME Server

Server-side CGI scripts fail

Offline alext

  • ****
  • 91
  • +0/-0
Server-side CGI scripts fail
« on: December 05, 2004, 10:23:31 AM »
I've just installed a fresh SME 6.0 server and created a starter website. I connected via the internal LAN from a windows workstation and transfered some HTML and CGI test files.
When attempting to link through the files via my browser it's OK with the HTML files but I get the dreaded SEVERE INTERNAL SERVER error, (500), whenever I try to link to a CGI script.
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 cosole.

What am I doing wrong? Can anybody help please?
...

monkey

Server-side CGI scripts fail
« Reply #1 on: December 05, 2004, 11:38:09 AM »
I am not a CGI developer, but maybe this link could put you on the right path:

http://httpd.apache.org/docs/howto/cgi.html

It sounds like it might permissions reltated, but I am sure.

Offline alext

  • ****
  • 91
  • +0/-0
Server-side CGI scripts fail
« Reply #2 on: December 05, 2004, 11:56:15 AM »
Thanks for the advice and pointer.

As I am testing internally, I have set all permissions for Owner, Group and All to RWE (all bits set).
My Perl path is #!/usr/bin/perl

Just a thought; if I add an virtual domain, one of the config params asks if I want to allow CGI/PHP script execution.
I am using the Primary domain but there is no parameter to allow/disallow this feature. Is it permanantly allowed?

Still having problems...
...

totodiaz

Server-side CGI scripts fail
« Reply #3 on: December 05, 2004, 04:23:14 PM »
1 Yes, the changes will stay.
2 You need to make the cgi file executable. Thy this:

"Put your script in /home/e-smith/files/primary/cgi-bin directory. Open a session (SSH) on SME server as root user. Type this command:

chmod a+x /home/e-smith/files/primary/cgi-bin/your_script "

Offline alext

  • ****
  • 91
  • +0/-0
Still problems...
« Reply #4 on: December 05, 2004, 10:45:42 PM »
Thanks for the advice, Totodiaz, but sadly it didn't work.

I have reduced the whole thing to three files in the PRIMARY ibay:

  /html/index.htm
   /cgi-bin/test.cgi
   /cgi-bin/test.htm


I followed your advice with chmod and to make sure I set both files in the cgi-bin directory have all access bits set (0777)

I have put two anchors in the index.htm file:

<a href="/cgi-bin/test.cgi">test cgi</a>
<a href="/cgi-bin/test.htm">test htm</a>


When trying either link I get the 500 Internal Server Error, (including the test.htm file)

I have tried all combinations of .  .. ./ ../ on the front of the anchor links and I have also tried a fully qualified link, (www.domain.ch/cgi-bin/test.cgi), but all fail.

Any ideas?
...

Offline Reinhold

  • *
  • 517
  • +0/-0
    • http://127.0.0.1
Server-side CGI scripts fail
« Reply #5 on: December 06, 2004, 09:21:52 AM »
alex,

Just show us those 3 files and the rights you applied to them and where you placed them (full SME hierarchy) as a complete post.

What you write confuses me but the usual path is:
index.html
../cgi-bin/test.cgi

try a direct access to the cgi-bin via IP and NO "www"
http://mysmeserverIP/cgi-bin/test.cgi
and report

Regards
Reinhold

P.S.: those leading slashes are NEVER a good idea!
............

Offline alext

  • ****
  • 91
  • +0/-0
Server-side CGI scripts fail
« Reply #6 on: December 06, 2004, 11:19:49 AM »
Hi Reinhold,

Thanks for your response.
Last night I completely flattened my SME server and did a rebuild to ensure that the system is 'clean'.

I have re-created the files and have the same problem.
I have tried your suggestion of accessing via http://192.168.100.200/cgi-bin/test.cgi  (with NO www) but get the same 500 Internal Server Error.  (I also tried the same with the test.htm file in that directory and got the same error).

Below is are locations and rights of the 3 files followd by a printout of each file together with the rights of the cgi-bin directory, (sorry for the silly names in the index file).

Hope this helps and thanks once again,
Alex.

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

  /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>Sheep 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>Sheep Foundation</H1></FONT></TD>
  </TR>
  <TR>
  <TD BGCOLOR="#F7E0B5" WIDTH="15%">&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" WIDTH="85%">
  <FONT COLOR="#000000"><H2>Leaders in Sheep Technology</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>
...