It's impossible to return a 404 status code from php scripts executed in normal mode (not server.error-handler-404). Other status code works, for example:
<?php
header('Status: 301');
print_r($_SERVER);
?>
this page does return the right HTTP/1.1 301 Moved Permanently header, but
<?php
header('Status: 404');
print_r($_SERVER);
?>
does return the HTTP/1.1 200 OK header.
Someone argued that I don't need to have PHP scripts return 404 status codes, but this is incorrect. If I remove one record from my database and a search engine spider tries to access the now outdated url pointing to that record, I need to be able to show a 404 error so it won't index that page, and eventually remove it from its index.