Current time: 02-17-2025, 07:40 AM Hello There, Guest! (LoginRegister)


Thread Closed 
Run CGI Script from cgi-bin 500 error
Author Message
Nuxwin
Unregistered

 
Post: #12
RE: Run CGI Script from cgi-bin 500 error
Hello ;

What you use as language for your cgi script ;

Examples (work fine for me):

First, my test config:

ispCP omega 1.0.3 on OpenSUSE.

Code:
ispcp:/srv/www/virtual/xn--bcher-kva.net/cgi-bin # ls -la
total 16
drwxr-xr-x 2 vu2001 vu2001 4096 déc. 18 00:17 .
drwxrwx--- 8 vu2001 www    4096 déc. 14 01:20 ..
-rwxr-x--- 1 vu2001 vu2001   86 déc. 17 23:47 test-cgi
-rwxr-x--- 1 vu2001 vu2001   89 déc. 18 00:18 tests-cgi

First: shell script

This script contain the following content:
Code:
ispcp:/srv/www/virtual/xn--bcher-kva.net/cgi-bin # cat test-cgi
#!/bin/sh

set -f

echo Content-type: text/plain
echo

echo "Hello World"

The result in my browser is:
Code:
Hello World

Second: perl script:

This script contain the following content:
Code:
ispcp:/srv/www/virtual/xn--bcher-kva.net/cgi-bin # cat tests-cgi
#!/usr/bin/perl

use CGI;

my $request = new CGI;

print $request->header;
print "Hello World!";

The result in my browser is:
Code:
Hello World!

BUT :

If I change the content of the last script as this:

Code:
ispcp:/srv/www/virtual/xn--bcher-kva.net/cgi-bin # cat tests-cgi
#!/usr/bin/perl

print "Hello World!";

The result in my browser is:
Code:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@xn--bcher-kva.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.10 (Linux/SUSE) Server at xn--bcher-kva.net Port 80

Why ? It's just an header issue. Wink

Note : If you want not use the perl CGI package, you can do as this instead ;
Code:
#!/usr/bin/perl

print "Content-type: text/plain\n\n";
print "Hello World!";

Note: The header should be always followed by an empty line.

Cheers ;
12-18-2009 09:28 AM
Thread Closed 


Messages In This Thread
RE: Run CGI Script from cgi-bin 500 error - Nuxwin - 12-18-2009 09:28 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)