There is the following issue: I have to detect FastCGI SAPI in order to send off a custom response. For FastCGI it looks like 'Status 404 Not Found' against standard 'HTTP/1.1 404 Not Found'. As far as I know PHP implements FastCGI only as a part of FPM.
So is it right way to detect FastCGI:
if (preg_match('|fpm|', PHP_SAPI))
print('FastCGI');