Current time: 11-25-2024, 07:50 AM Hello There, Guest! (LoginRegister)


Thread Closed 
Run CGI Script from cgi-bin 500 error
Author Message
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #11
RE: Run CGI Script from cgi-bin 500 error
.htaccess is checked for existance in all folders that doesn't have "AllowOverride None" set. The "cgi-bin" folder itself should be owned by vuXXX:vuXXX and have 0755 permissions.

Coincidentally, I've got a report from one of my users about the same issue. At the end, it turned out that he was using "#!/usr/local/bin/perl" as shebang, which doesn't exist on my server. The front-error was "500 internal server error", and there was an entry in "/var/log/apache2/suexec.log" stating "(2)No such file or directory: exec failed (script.cgi)".

Replacing the shebang by the correct "#!/usr/bin/perl" solved the issue...
12-18-2009 08:23 AM
Visit this user's website Find all posts by this user
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
motokochan Offline
Member
***

Posts: 274
Joined: Jul 2008
Reputation: 1
Post: #13
RE: Run CGI Script from cgi-bin 500 error
(12-18-2009 06:57 AM)cmendes0101 Wrote:  What permission should the actual cgi-bin folder have? I set it to 0750

It should be 755 minimum to allow Apache to traverse it. The default ownership is for both user and group to be the vu entry for that site. Giving world no permissions also blocks Apache.


(12-18-2009 06:57 AM)cmendes0101 Wrote:  [Thu Dec 17 20:47:30 2009] [crit] [client 173.58.48.72] (13)Permission denied: /var/www/virtual/chrismendes.us/cgi-bin/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

There is no .htaccess file in there. Should there have been? No other domain has htaccess either.

That's related to the permissions you set. Apache can't look into the directory for an htaccess file, so it gives that error.
12-18-2009 09:58 AM
Visit this user's website Find all posts by this user
Thread Closed 


Forum Jump:


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