1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Premature end of script headers

Discussion in 'General Discussion' started by Menta2K, May 19, 2009.

  1. Menta2K

    Menta2K New Member

    Joined:
    Apr 11, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    I have a very strange problem.
    in last few days i saw too many "Premature end of script headers" in apache log file
    cat /usr/local/apache/logs/error_log |grep "Premature end of script headers" |wc -l
    4190
    Its happens only on php files perl cgi scripts are working just fine.
    Right now i am with last php version but sill have that problems.
    php -v
    PHP 5.2.9 (cgi-fcgi) (built: May 19 2009 07:04:00)
    Copyright (c) 1997-2009 The PHP Group
    (php scripts are runing with suphp . ist updated too )

    In addition to that i try to remove ulimits for all users on the system , removed a
    RLimitMEM 2003933525 and RLimitCPU 240 from the httpd.conf
    Unfortunatly that did not help at all ..

    Then i try to change semaphores
    sysctl -a |grep sem
    kernel.sem = 350 32000 32 128
    ipcs -a |grep nobody |wc -l
    15
    But nothing changed ..
    I double checked for a big log files dont have such files,

    Right now i am in dead end. Dont have any ideas what can be wrong. :confused:

    I will appreciate ny ideas or suggestions.
     
  2. SB-Nick

    SB-Nick Member

    Joined:
    Aug 26, 2008
    Messages:
    134
    Likes Received:
    0
    Trophy Points:
    16
    Hey,

    Did you try switching the PHP handler to CGI and see if it still failing by chance?
     
  3. DaveUsedToWorkHere

    Joined:
    Dec 28, 2001
    Messages:
    742
    Likes Received:
    1
    Trophy Points:
    18
    Unfortunately, this error can be a pain to track down as it is applicable for multiple situations. Try these:

    1) Ensure the script that errors is owned by the proper user
    2) Ensure the script is executable
    3) Ensure the script executes from the command line and provides proper headers


    Often enough, it's 1 or 2 causing the issue if the script hasn't changed and the error now exists.
     
  4. PlatinumServerM

    Joined:
    Jul 10, 2005
    Messages:
    396
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Jersey, USA
    You really need to debug something like this, because there's no single answer that will fix this generic issue. Check permissions, test a phpinfo, review the logs, etc. You may also want to try recompiling php just in case if you have nothing else to try.
     
  5. FatalSw1tch

    FatalSw1tch New Member

    Joined:
    Dec 12, 2003
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago, IL
    Personally sounds like wrong permissions on the script in question. However without seeing the logs and the permissions on the scripts no way to know for sure.
     
  6. Menta2K

    Menta2K New Member

    Joined:
    Apr 11, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    [Solved] Premature end of script headers

    Issue was solved. That was most weird apache behaviour i ever seen.
    Problem was in mod_jk. In my previous post i forgot to mention that i have several jsp client on that server.
    At one moment i saw lots of TIME_WAIT connection in netstat all of them are from apache to tomcat application server.
    When i stop the tomcat everything started to work just fine.
    When i start it again Premature end of script headers error comes again.
    The weird think is that Premature end of script headers error happens on non java related hosts.
    Anyway when i update a mod_jk to last stable version 1.2.28 everything start working just fine.
    Maybe is not a bad idea EasyApache developers to upgrade a tomcat-connector to last stable release.
    Obviously there are very strange bug in apache <-> mod_jk
     

Share This Page