Use PHP_SAPI constant instead of php_sapi_name() method.