phpcms转到https后无法注册问题的解决

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);

下载 此文件

你可能感兴趣的:(WEB,php)