Can PHP complete handshake if hostname and CN cert do not match?

36 Views Asked by At

I am facing a connection issue in my PHP program that was previously working. It turns out the servers' tomcat cert was replaced with a SAN cert and the CN of the cert no longer matches the hostname. The hostname is defined as a SAN entry, however I still cannot connect. Even if defining a cafile to the cert, if fails. Here is my script:

    <?php
    
    $host = "server_name";
    $username = "******";
    $password = "******";
    
    $context =
        stream_context_create(array('ssl'=>array('allow_self_signed'=>true)));
        
        $client = new SoapClient("C:\inetpub\wwwroot\PhoneSetup\axl\AXLAPI.wsdl",
            array('trace'=>true,
           'exceptions'=>true,
           'location'=>"https://".$host.":8443/axl",
           'login'=>$username,
           'password'=>$password,
           'stream_context'=>$context
    
        ));
  
    $response = $client->getPhone(array("name"=>"SEP28AFFDA53393"));
    var_dump($response);
    
    
    ?>

I am using PHP 7.3 and do not see any updates to the ssl options so don't believe updating PHP will resolve this. If anyone can provide any help I would appreciate it.

Thanks.

0

There are 0 best solutions below