php-redis extension installation (phpredis)

不言
Release: 2023-03-24 19:46:01
Original
1956 people have browsed it

This article introduces the content of php-redis extension installation (phpredis), which has certain reference value. Now I share it with everyone. Friends in need can refer to it.

# wget http://pecl.php.net/get/redis-3.1.6.tgz
# mv redis-3.1.6.tgz php-redis-3.1.6.tgz
# tar -zxvf php-redis-3.1.6.tgz
# mv redis-3.1.6 php-redis-3.1.6
# cd php-redis-3.1.6
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
Copy after login

Modify the php.ini file

Add a line:

[redis]
extension = redis.so
Copy after login

Restart php-fpm: kill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`


##【php test
##

//实例化redis
$redis = new Redis();
//连接
$redis->connect('127.0.0.1', 6379);
//检测是否连接成功
echo "Server is running: " . $redis->ping();
// 输出结果 Server is running: +PONG
Copy after login
Related recommendations:

php-redis session operation

Php-Redis installation test notes

The above is the detailed content of php-redis extension installation (phpredis). For more information, please follow other related articles on the PHP Chinese website!

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