in reply to Premature end of script headers

A complete header is needed to have a succesfull http response. You must analyze what your cgi script sends back and inspect headers to check they are complete and valid. If some error occurs (MySQL connection?) before headers are emitted you can have such errors too. You can test the cgi in command line (bypassing the server completely), see Testing out a CGI script using the command line

Might be that the server put some hands in header composition and the results is bad. In this case you can, empirically speaking, try to play with no-parse-header CGI mode and, eventually modifying the cgi code, tell the script to produce a complete and valid header.

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Premature end of script headers
by gszabo (Novice) on Sep 30, 2015 at 09:10 UTC
    update
    The script is index.cgi, copied by the install.sh script. the script is okay, i can run it in a virtual debian with similar settings ( apache, perl version )
    Checked apache logs and found this line only nothing else.
    Tue Sep 29 08:55:54 2015] [info] [client 10.10.10.2] Connection closed + to child 3 with standard shutdown (server my.test.gestio.hu:443) [Tue Sep 29 08:55:56 2015] [info] [client 10.10.10.2] Connection to ch +ild 4 established (server my.test.gestio.hu:443) [Tue Sep 29 08:55:56 2015] [info] Seeding PRNG with 656 bytes of entro +py [Tue Sep 29 08:55:56 2015] [info] Initial (No.1) HTTPS request receive +d for child 4 (server my.test.gestio.hu:443) [Tue Sep 29 08:55:56 2015] [error] [client 10.10.10.2] Premature end o +f script headers: index.cgi [Tue Sep 29 08:55:56 2015] [info] [client 10.10.10.2] Connection close +d to child 4 with standard shutdown (server my.test.gestio.hu:443) [Tue Sep 29 09:43:56 2015] [info] [client 10.10.10.2] Connection to ch +ild 5 established (server my.test.gestio.hu:443) [Tue Sep 29 09:43:56 2015] [info] Seeding PRNG with 656 bytes of entro +py [Tue Sep 29 09:43:56 2015] [info] Initial (No.1) HTTPS request receive +d for child 5 (server my.test.gestio.hu:443) [Tue Sep 29 09:43:56 2015] [info] [client 10.10.10.2] Connection close +d to child 5 with standard shutdown (server my.test.gestio.hu:443) [Tue Sep 29 09:44:00 2015] [info] [client 10.10.10.2] Connection to ch +ild 9 established (server my.test.gestio.hu:443) [Tue Sep 29 09:44:00 2015] [info] Seeding PRNG with 656 bytes of entro +py [Tue Sep 29 09:44:05 2015] [info] Initial (No.1) HTTPS request receive +d for child 9 (server my.test.gestio.hu:443) [Tue Sep 29 09:44:05 2015] [error] [client 10.10.10.2] Premature end o +f script headers: index.cgi [Tue Sep 29 09:44:05 2015] [info] [client 10.10.10.2] Connection close +d to child 9 with standard shutdown (server my.test.gestio.hu:443)
    I try to run another .cgi perl script, but get the same error always.
    i do not use fasrcgi or suexec, i have read they could made similar errors.
    I have a goog running system as well with this script, so i just need to figure out the difference what cause this error.

      work through the check lists