Results 1 to 6 of 6

Thread: Premature end of script headers

  1. #1
    Registered Member
    Join Date
    Apr 2006
    Posts
    16

    Angry Premature end of script headers

    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.

    I will appreciate ny ideas or suggestions.

  2. #2
    Registered Member SB-Nick's Avatar
    Join Date
    Aug 2008
    Posts
    134
    cPanel Access Level

    Root Administrator

    Default

    Hey,

    Did you try switching the PHP handler to CGI and see if it still failing by chance?
    :: Server Buddies ::

    Server Management & Monitoring

    .Dedicated Server Solutions At Affordable Rates.

  3. #3
    Registered Member
    Join Date
    Dec 2001
    Posts
    742

    Default

    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. #4
    Registered Member cPanel Partner NOC Badge
    Join Date
    Jul 2005
    Location
    New Jersey, USA
    Posts
    395

    Default

    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. #5
    Registered Member FatalSw1tch's Avatar
    Join Date
    Dec 2003
    Location
    Chicago, IL
    Posts
    14

    Default

    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.
    "Dude its the Cart!!"

    - Tweaking cPanel on the daily -

  6. #6
    Registered Member
    Join Date
    Apr 2006
    Posts
    16

    Default [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

Similar Threads

  1. Premature end of script headers
    By linux25 in forum EasyApache
    Replies: 3
    Last Post: 05-27-2014, 10:46 AM
  2. Premature end of script headers (suphp problem)
    By AL-Kateb in forum General Discussion
    Replies: 4
    Last Post: 10-27-2010, 10:50 AM
  3. Premature end of script headers
    By camposomar in forum General Discussion
    Replies: 2
    Last Post: 10-02-2009, 05:37 PM
  4. Replies: 1
    Last Post: 07-18-2006, 08:42 PM
  5. Error: Premature end of script headers
    By kaizenwerks in forum Database Discussions
    Replies: 2
    Last Post: 01-30-2006, 03:02 PM
bargain