PHP fatal errors come back as status code 200 to the HTTP client. How can I make it return a status code 500 (Internal server error)?
Since PHP >= 5.4
http_response_code(500); echo json_encode( [ 'success' => false , 'message' => 'Crazy thing just happened!' ]); exit();
Please set the httpCode before echo.
echo