How can i trigger 500 Internal Server Error or 404 Page Not Found Apache errors in PHP?
For 500 Internal Server Error i have tried
Apparently there is a function called http_response_code that will let you set the response code appropriately. If that doesn't work (there's a note in the documentation about it possibly being only in SVN) then the header function can take an optional response code argument:
header("HTTP/1.0 ...", true, 404);
This should signal Apache correctly.