Home >Backend Development >PHP Tutorial >PHP uses phpredis to link redis error

PHP uses phpredis to link redis error

WBOY
WBOYOriginal
2016-12-01 00:25:373996browse

As mentioned, the project uses phpredislink redis, and occasionally the following error is reported:

<code>PHP Fatal error:  Uncaught exception 'RedisException' with message 'Failed to AUTH connection' in [no active file]:0
Stack trace:
#0 {main}

  thrown in [no active file] on line 0```</code>
  1. checkThe configuration information of the project is correct, this error message appears occasionally

  2. Use redis to process session

  3. in the project
  4. Found someone in the issues of github who encountered a similar problem, but the reason and how to solve it were not given. Portal github

Have you encountered similar problems in your projects? Should you use the predis extension directly?

Reply content:

As mentioned, the project uses phpredislink redis, and occasionally the following error is reported:

<code>PHP Fatal error:  Uncaught exception 'RedisException' with message 'Failed to AUTH connection' in [no active file]:0
Stack trace:
#0 {main}

  thrown in [no active file] on line 0```</code>
  1. checkThe configuration information of the project is correct, this error message appears occasionally

  2. Use redis to process session

  3. in the project
  4. Found someone in the issues of github who encountered a similar problem, but the reason and how to solve it were not given. Portal github

Have you encountered similar problems in your projects? Should you use the predis extension directly?

Purely complaining, the phpredis extension is getting more and more painful. . . .

See if the error is an authorization-related error. Check whether Redis has a password. If it is a cluster deployment, whether the environment is inconsistent

<code>$client = new Predis\Client(array(
    'scheme'   => 'tcp',
    'host'     => '127.0.0.1',
    'port'     => 6379,
    'database' => 15,
    'password' => '密码'
));</code>

Did the authentication prompt fail?

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