FCGI_SetExitStatus()
does not set the HTTP
status code; the exit code it sets only has application-level meaning.
You need to output an additional header like Status: 404 Not Found
. See this similar question on stackoverflow and the FastCGI FAQ.