Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Malformed header

Could someone explain what is wrong with this PHP code? (PHP Version 5.3.5)

<?php 
    header('Bad Request', true, 400);
    exit;

I get a status 500 instead of 400. And in the apache error log I get

malformed header from script. Bad header=Bad Request: listener.php

What am I doing wrong here? Have I misunderstood the docs?

like image 709
Svish Avatar asked May 23 '11 21:05

Svish


1 Answers

you have to write:

header('HTTP/1.0 400 Bad Request', true, 400);
like image 77
Racooon Avatar answered Oct 16 '22 10:10

Racooon