Results 1 to 2 of 2
My hello world script works perfect at command line however causes an "internal server error" when I try to view it by browser. I run a Fedora Linux with Plesk ...
- 07-01-2004 #1Just Joined!
- Join Date
- Jul 2004
- Location
- izmir
- Posts
- 4
CGI problem, works at the command line, but not on the brows
My hello world script works perfect at command line however causes an "internal server error" when I try to view it by browser. I run a Fedora Linux with Plesk 7.
I uploaded it in ASCII mode for sure.
CHMOD is 755.
Below is th result of "ls -la" command:
---------------------------------------------------------------------
drwxr-x--- 2 domaincom psaserv 4096 Jun 30 18:34 .
drwxr-xr-x 14 root root 4096 Jun 29 23:54 ..
-rwxr-xr-x 1 domaincom psacln 83 Jun 30 18:35 hello_world.cgi
-rwxr-xr-x 1 domaincom psacln 83 Jun 30 18:35 hello_world.pl
---------------------------------------------------------------------
The first line which is the path to Perl is correct.
The first output is a heder which indicates this is an HTML code.
Below is the code which inside hello_world.cgi
---------------------------------------------------------------------
#!/usr/bin/perl
print "content-type: text/html\n\n";
print "Hello, World...\n";
---------------------------------------------------------------------
./hello_world.cgi works fine
Below is the result when I run "./hello_world.cgi" command:
---------------------------------------------------------------------
content-type: text/html
Hello, World...
---------------------------------------------------------------------
perl hello_world.cgi works fine
Below is the result when I run "perl hello_world.cgi" command:
---------------------------------------------------------------------
content-type: text/html
Hello, World...
---------------------------------------------------------------------
I get an internal server error message when I try to see it with the browser.
In the error log for the domain, it says "Premature end of script headers:" for this request.
In the suexec_log, I have the following lines: (For security reasons, I renamed ftpusername and domain.com parts)
[2004-07-01 08:12:12]: uid: (10001/ftpusername) gid: (10001/10001) cmd: hello_world.cgi
[2004-07-01 08:12:12]: command not in docroot (/data/httpd/vhosts/domain.com/cgi-bin/hello_world.cgi)
I am sure you know how I feel. Any help is appreciated.
Thank you.
- 07-01-2004 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
It seems that the problem is indeed in suexec. Apparently it wants the cgi script to be somewhere else.
I would believe the problem to be the very fact that you're using suexec for this. It's mainly meant to be used along with the userdir extension.
The fault you're getting is because of the following: suexec expects all scripts to be in a directory that begins with the home directory of the user it's trying to run the script as + "public_html".


Reply With Quote
