如何确定运行PHP应用程序的Web服务器(Apache)是否支持HTTPS?

Please note, I want to find out if it is capable of accepting HTTPS requests, not whether it's currently using it. Please also note, that scanning ports or making any other [a]synchronous requests is not an option in my case because it needs to be very quick.

Is there a way to "ask" Apache about it eg: from the command line?

Edit: Thanks for all the ideas but they are for "manual" checking of the above mentioned fact by a human like you and me. That part I can figure out, believe me. I just thought it's obvious that these phrases "[a]synchronous requests" and "it needs to be very quick" imply SOFTWARE in form of a PHP APPLICATION.

I think you need to run this code your page: <?php echo phpinfo(); and you will get all info about the version and settings

you can check this by phpinfo(); and also you can cheek that the mod_ssl is on or off

enter image description here

If this is a server you manage:

  1. Check if mod_ssl is enabled in Apache
  2. Check that you are listening on port 443 in Apache's ports.conf file
  3. Setup an SSL host to listen on the IP:port settings from ports.conf
  4. Check that you are not blocking port 443 with a firewall (there are many options for firewall here)

If you have configured Apache and have not closed the firewall, Apache should tell the OS to listen on port 443 and it will handle requests.

If this is a shared server or one not managed by yourself - ask your server support/admin

Here is a way to check for HTTPS protocol support, saving phpinfo() information into an array:

// NOTE: This section was extracted from the PHP Manual, example from **jon at sitewizard dot ca**
ob_start();
phpinfo();
$PHPInfo = array( 'phpinfo' => array() );
if ( preg_match_all( '#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
                     ob_get_clean(), $Matches, PREG_SET_ORDER )
) {
  foreach ( $Matches as $Value ) {
    if ( strlen( $Value[ 1 ] ) ) {
      $PHPInfo[ $Value[ 1 ] ] = array();
    }
    elseif ( isset( $Value[ 3 ] ) ) {
      $PHPInfo[ end( array_keys( $PHPInfo ) ) ][ $Value[ 2 ] ] = isset( $Value[ 4 ] ) ? array( $Value[ 3 ],
                                                                                               $Value[ 4 ] ) : $Value[ 3 ];
    }
    else {
      $PHPInfo[ end( array_keys( $PHPInfo ) ) ][ ] = $Value[ 2 ];
    }
  }
}

// End of extracted section ----------------------

$HTTPS      = $PHPInfo[ 'curl' ][ 'Protocols' ];
$HTTPSFound = mb_strstr( $HTTPS, 'https', FALSE );

if ( $HTTPSFound ) {
  echo "HTTPS supported<br /><br />";
}
else {
  echo "HTTPS NOT supported<br /><br />";
}

ADDITIONAL NOTE: THIS ANSWER DOES NOT REQUIRE A "MANUAL CHECKING". IT GETS THE INFORMATION THROUGH THE SCRIPT!