这篇文章介绍的内容是关于php-redis扩展安装(phpredis) ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
# 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
修改php.ini文件
添加一行:
[redis] extension = redis.so
重启php-fpm:kill -usr2 `cat /usr/local/php/var/run/php-fpm.pid`
【php测试】
//实例化redis $redis = new Redis(); //连接 $redis->connect('127.0.0.1', 6379); //检测是否连接成功 echo "Server is running: " . $redis->ping(); // 输出结果 Server is running: +PONG
相关推荐:
立即学习“PHP免费学习笔记(深入)”;
以上就是php-redis扩展安装(phpredis)的详细内容,更多请关注php中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号