• I have Apache 1.3.x, PHP 4, and Mysql 3.x on my PC. I’ve tried to install wordpress 2.0. It’s fine with the admin page, and when I tried to open https://localhost/wordpress/ ( the directory is /wordpress ) it shows an internal error ( 500 I think ). It’s telling me to refer back to error log and I found this error :

    [Thu Jan 19 12:29:16 2006] [error] [client 127.0.0.1] malformed header from script. Bad header=HTTP/1.1 200 OK: c:/apache/php/php.exe

    I don’t know much about this error. Can anyone help me plz ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • This seems to have something to do with Apache’s dislike with getting the OK 200 header from WordPress acting as a CGI script.

    For the web server to accept this header, a CGI script should be NPH ( non parsing header ).

    Normally a simple CGI script should have a name ( or alias ) nph_foo.cgi, which forces the server to ignore any http headers.

    If not, the headers are parsed and the server will add the 200 OK header.

    Ref.:
    https://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67280

    These are really technical matters, and I don’t know how WordPress handles the http standard headers.

    Any one?

    I am getting this error as well.Any idea on how to fix. thanks

    We don’t control our web server and it will always parse headers from php scripts.
    The simple solution was to edit one of the php files and remove the line that sent the header

    in wp-includes/functions.php around line 2200 in my version
    Note the line that has a ‘#’ in front 2 lines up from the closing }
    function status_header( $header ) {
    if ( 200 == $header )
    $text = ‘OK’;
    elseif ( 301 == $header )
    $text = ‘Moved Permanently’;
    elseif ( 302 == $header )
    $text = ‘Moved Temporarily’;
    elseif ( 304 == $header )
    $text = ‘Not Modified’;
    elseif ( 404 == $header )
    $text = ‘Not Found’;
    elseif ( 410 == $header )
    $text = ‘Gone’;

    # @header(“HTTP/1.1 $header $text”);
    @header(“Status: $header $text”);
    }

    Thank you best-socks,

    This commenting out the header function call worked for me too !!!

    Would never have found it without this post.

    >>This is the magic line to comment-out, e.g. prepend (#) like this:
    # @header(“HTTP/1.1 $header $text”);

    >>I found this in ‘wp-includes/functions.php’ line: 2232 like best-socks suggested it would be around there.

    Thanx a lot guys! I got the same problem and now it’s solved. Cheers.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    What version of PHP do you have? What version of Apache? I’ve seen this sort of thing on older versions, but upgrading to the latest PHP and/or Apache has always fixed it. Also, it only happens when you’re using PHP as a CGI program, which is not recommended anyway. Use the Apache module instead. It’s faster, it’s better, it tends to “just work”.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘I have an error : malformed header from script . Bad header …’ is closed to new replies.