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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content