Troubleshooting “Permission denied” when attempting to connect to Redis from PHP script

StackOverflow https://stackoverflow.com/questions/8771372

  •  14-04-2021
  •  | 
  •  

문제

Port 6379 is open on the server, and I can successfully run telnet localhost 6379 in SSH.

I tried both Predis/phpredis client library in PHP, but it still does not work:

  • Predis gives "Permission denied" error when opening socket to 6379.
  • phpredis gives "redis server went away".
도움이 되었습니까?

해결책

Problem solved, type:

/usr/sbin/setsebool httpd_can_network_connect=1

By default, SELinux does not allow Apache to make socket connections. More information can be found here.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top