phpcms升级ssl,https后,会员无法登陆解决
2020-02-23 02:49:18   来源:   浏览: 次

导读:phpcms modules member classes client class php中361行修改如下:$port = !empty($matches[& 39;port& 39;]) ? $matches[& 39;port&
phpcms/modules/member/classes/client.class.php 
 
中361行修改如下:
 
$port = !empty($matches['port']) ? $matches['port'] : ( strtolower($matches['scheme'])=='https' ? 443 : 80 );
 
第386行将:
 
$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);
 
替换为
 
$contextOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false
    )
);
 
//如果有签名的证书
//$contextOptions = array(
//    'ssl' => array(
//        'verify_peer' => true, 
//        'cafile' => '/path/to/cacert.pem',
//        //'CN_match' => 'indexroot.net', // 匹配域名
//        'ciphers' => 'HIGH:!SSLv2:!SSLv3',
//        'disable_compression' => true,
//    )
//);
 
$context = stream_context_create($contextOptions);
$fp = stream_socket_client("ssl://{$host}:{$port}", $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context);