Home >Backend Development >PHP Tutorial >php-redis extension installation (phpredis)

php-redis extension installation (phpredis)

不言
不言Original
2018-04-26 09:08:001999browse

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

Modify the php.ini file

Add a line:

[redis]
extension = redis.so

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
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!

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
Previous article:php empty()Next article:php empty()