phpauthenticationsdkfastcgimod-php

Detecting Whether or not fastCGI is running on a remote server


Pretty much every answer I get, involves phpinfo(), which doesn’t help me.

I have an SDK for a PHP-based server that uses Basic Auth (bearer token/secret stuff). However, when the server is running fastCGI, the SDK needs to send the auth as query params.

It’s not difficult to add a manual switch to the SDK, but I’m wondering if there’s a way for the SDK (which is written in Swift) to detect fastCGI on the server end.

I should note that I also wrote the server, so I could add a response to a query, flagging fastCGI. That seems to be a bit of a “kludge,” though.

Is there a way to determine whether or not a remote server is running fastCGI?


Solution

  • Yeeahhh... looks like this is a tumbleweed farm.

    I determined that there's really no opaque way to find out what's the server running, so I added a fast command to the server.

    Here's what I did:

    // This is a test, to see whether or not we should use auth parameters (fastCGI).
    if ((1 == count($this->_path)) && ('use_auth_params' == $this->_path[0])) {
        exit('cgi' == substr(php_sapi_name(), 0, 3) ? '1' : '0');
    }