phpcms v9登錄失???phpcmsv9全站 https ssl后會員登錄失敗解決方法
很多朋友在使用phpcmsv9的時候遇到了這樣一個問題,在將全站https化后,會員中心無法正常登錄,具體是沒有返回值,提示登錄失敗,主要是原來是系統(tǒng)在初始化phpsso時,無法將數(shù)據(jù)通過443傳輸?shù)綄?yīng)的方法,通過排查問題,可以看到在client.class.php中,系統(tǒng)默認(rèn)使用的端口是80,所以我們只需要按以下方法修改就可以解決在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);
PHP中文網(wǎng),大量的免費PHPCMS教程,歡迎在線學(xué)習(xí)!