Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Location
    izmir
    Posts
    11

    * CGI problem, works at the command line, but not on the browser

    My hello world script works perfect at command line however causes in 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.
    Last edited by izmir; 07-01-2004 at 02:14 AM.

  2. #2
    Join Date
    Mar 2003
    Location
    London, UK
    Posts
    170
    From the suEXEC website:

    "For security and efficiency reasons, all suexec requests must remain within either a top-level document root for virtual host requests, or one top-level personal document root for userdir requests. For example, if you have four VirtualHosts configured, you would need to structure all of your VHosts' document roots off of one main Apache document hierarchy to take advantage of suEXEC for VirtualHosts. (Example forthcoming.)"

  3. #3
    Join Date
    Jul 2003
    Location
    Nothing but, net
    Posts
    2,064
    Try Content-Type: text/html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •