uncaught exception redisexception with message Connection closed

PHPz
Release: 2018-10-10 14:08:54
Original
11584 people have browsed it

When running redis in LNMP environment, the following error occurs: "PHP Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in". How to solve it?

Reply content:

Specific question: When running redis in LNMP environment, the following error "PHP Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in" appears. How to solve it?

The best adopted answer:

I just encountered this problem today. The solutions found online (such as setting connection timeout, etc.) are invalid. Solve it yourself and then answer it:

Redis check---- -------------------------->

1. Check whether the redis service is started: ps -ef | grep redis

2. OK The port number that redis runs on: such as the default 6379

3, telnet 127.0.0.1 6379. If the connection fails, check the firewall settings and open port 6379

4. Redis configuration check: timeout 0 (no timeout) in redis.conf, bind 127.0.0.1 (If redis is not used locally, configure the user machine IP for ip, or set it directly to 0.0.0.0 without restrictions)

PHP setting check---------------- -------------->

1. Determine whether PHP has the redis extension installed: extension = redis.so has been configured in php.ini, and redis.so exists

2. Check the php.ini file: default_socket_timeout = 600 (unit is s, set at least 60s)

The most important thing, if you use redis to manage sessions, then check the php.ini file:

session.save_handler = redis

session .save_path = "tcp://127.0.0.1:6379" (The redis ip and port here must be set correctly!)

[Related tutorial recommendations]

Online free video tutorials:Redis video tutorial

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!