Home  >  Article  >  Backend Development  >  When connecting to redis using PHP online, sometimes redis went away. What causes this?

When connecting to redis using PHP online, sometimes redis went away. What causes this?

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

The frequency is not particularly high, but it does happen. I directly downloaded redis from the official website and configured it with the default redis.conf. .

Reply content:

The frequency is not particularly high, but it does happen. I directly downloaded redis from the official website and configured it with the default redis.conf. .

<code>是因为selinux的安全机制才导致这个错误。当我解决掉这个错误,运行起服务器的时候,这个redis.php在浏览器就可以正常运行了。所以,出现Redis server went away 的原因就找到了。selinux。解决方案是:
[php] view plain copy print?
/usr/bin/setenforce 是用来修改SELinux的实时运行模式的  
 临时打开:  
setenforce 1          ----设置SELinux 成为enforcing模式  
 临时关闭:  
setenforce 0          ----设置SELinux 成为permissive模式  
 如果要彻底禁用SELinux 需要在/etc/sysconfig/selinux中设置参数selinux=0 ,或者在/etc/grub.conf中添加这个参数  
 /usr/bin/setstatus -v  </code>

Not connected, remote connection needs to be bound to IP

<code>redis.conf里的下面配置,加上你的ip:

bind 127.0.0.1 ::1  yourip</code>

Take another look, can you connect directly using the client? If successful, use php to connect

The request volume is large, try changing it to pconnect
http://blog.csdn.net/u0134744...

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