Apache HTTPD throw HTTP 500 error with premature end of script headers in logs

Solution Verified - Updated -


  • While accessing the CGI scripts, Apache HTTPD shows HTTP 500 error in web browser. At the same time, HTTPD access_log and error_log shows below messages.

    "GET /cgi-bin/test.pl?user=admin HTTP/1.1" 500"
    (8)Exec format error: exec of '/var/www/cgi-bin/test.pl' failed Premature end of script headers: test.pl


  • Red Hat Enterprise Linux (RHEL)
    • 6.7
  • Apache HTTPD

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In