Home  >  Article  >  CMS Tutorial  >  What to do if login fails in phpcms v9

What to do if login fails in phpcms v9

藏色散人
藏色散人Original
2020-02-04 10:11:002456browse

What to do if login fails in phpcms v9

phpcms v9 login failed? phpcmsv9 full site https ssl member login failure solution

What to do if login fails in phpcms v9

Many friends encountered this when using phpcmsv9 Such a problem is that after converting the whole site to https, the member center cannot log in normally. Specifically, there is no return value and prompts login failure. The main reason is that when the system initializes phpsso, it cannot transmit the data to the corresponding method through 443. To troubleshoot the problem, you can see that in client.class.php, the default port used by the system is 80, so we only need to modify it as follows to solve the problem of members being unable to log in after https:

What to do if login fails in phpcms v9

##phpcms/modules/member/classes/client.class.php

Line 361 in

is modified as follows:

$port = !empty($matches['port']) ? $matches['port'] : ( strtolower($matches['scheme'])=='https' ? 443 : 80 );

Line 386 replaces:

$fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout);

with

$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 Chinese website, a large number of free

PHPCMS tutorials, welcome to learn online!

The above is the detailed content of What to do if login fails in phpcms v9. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn