Установите PHP HTTP. Заголовок статуса

with a param sets the response code, without gets it.
 //set new response code 404:
  http_response_code(404);
// print out current response code
  var_dump(http_response_code());
Literate Lentil