Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to connect remote Redis in PHP

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What this article shares to you is about how to connect remote Redis in PHP. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. Configure the redis.conf file

1. I am using the source installation here, and the installation directory is in / usr/local/redis.

Because the source code installation needs to copy the configuration file itself, cp the file redis.conf to the redis directory in the source code location

two。 Modify the configuration file

Find daemonize no and change it to yes:

Note bind 127.0.0.1

Change protected-mode to no

If you can't find these operations at 01:30, I'll tell you a tip: don't press the input mode after opening the file. Press and hold [: / daemonize] and click enter to search for it directly, and then modify it.

Shutdown and startup of the 3.redis service

Cd / usr/local/redis

. / bin/redis-cli shutdown

4. View the service status of redis

2. PHP connects to remote redis

1. Under the premise of php-redis extension in your local PHP environment

2. Php code

3. Get all keys of redis

3. Detection

Let's set a key-value pair of redis in the linux environment and see if it can be obtained locally.

The above is how to connect remote Redis in PHP. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report