Centos下给php安装Redis扩展及编译问题解决
来源:互联网 发布:php在线考试系统 编辑:程序博客网 时间:2024/06/05 03:46
1、第一步自然是去github下载源码了,记得加上参数 --no-check-certificate,不然https校验会出错
wget https://github.com/phpredis/phpredis/archive/develop.zip --no-check-certificate
2、解压下载好的包,
unzip develop
cd phpredis-develop/
3、配置和编译,注意修改为php的安装目录位置
~/php/bin/phpize
./configure --with-php-config=~/php/bin/php-config
make && make install
正常情况下应该就编辑好so文件,并放到php的扩展目录下了,但是我在编译时出错了:
.libs/redis_cluster.o:(.data.rel.local+0x0): multiple definition of `arginfo_kscan'.libs/redis.o:(.data.rel.local+0xa0): first defined here.libs/redis_cluster.o:(.data.rel.local+0xe0): multiple definition of `arginfo_scan'.libs/redis.o:(.data.rel.local+0x0): first defined here
看错误是集群的代码问题,反正我的环境用不上集群,就注释掉这段代码吧:
vim redis_cluster.c
找到41行,注释这2段代码:
/* Argument info for HSCAN, SSCAN, HSCAN *//*ZEND_BEGIN_ARG_INFO_EX(arginfo_kscan, 0, 0, 2) ZEND_ARG_INFO(0, str_key) ZEND_ARG_INFO(1, i_iterator) ZEND_ARG_INFO(0, str_pattern) ZEND_ARG_INFO(0, i_count)ZEND_END_ARG_INFO();*//* Argument infor for SCAN *//*ZEND_BEGIN_ARG_INFO_EX(arginfo_scan, 0, 0, 2) ZEND_ARG_INFO(1, i_iterator) ZEND_ARG_INFO(0, str_node) ZEND_ARG_INFO(0, str_pattern) ZEND_ARG_INFO(0, i_count)ZEND_END_ARG_INFO();*/
保存后继续make && make install,这回是调用出错了:
phpredis-develop/redis_cluster.c:177: error: 'arginfo_scan' undeclared here (not in a function)phpredis-develop/redis_cluster.c:178: error: 'arginfo_kscan' undeclared here (not in a function)
继续编辑文件,删除下面4行调用代码:
PHP_ME(RedisCluster, evalsha, NULL, ZEND_ACC_PUBLIC)//PHP_ME(RedisCluster, scan, arginfo_scan, ZEND_ACC_PUBLIC)//PHP_ME(RedisCluster, sscan, arginfo_kscan, ZEND_ACC_PUBLIC)//PHP_ME(RedisCluster, zscan, arginfo_kscan, ZEND_ACC_PUBLIC)//PHP_ME(RedisCluster, hscan, arginfo_kscan, ZEND_ACC_PUBLIC)
ok,保存退出后再make && make install,这回成功了,
返回查看php/ext目录,有redis.so扩展了,重启php-fpm再看看phpinfo(),就有redis信息了:
Redis SupportenabledRedis Version2.2.5
写一段代码测试下吧:
$redis = new Redis();$conn = $redis->connect('127.0.0.1',6379);var_dump($redis->info());
页面应该会显示出redis的信息
0 0
- Centos下给php安装Redis扩展及编译问题解决
- centos安装redis及php-redis扩展
- centos安装redis及php-redis扩展
- Linux 下 PHP 扩展 redis 编译安装
- CentOS下编译安装PHP扩展库
- CentOS 下编译安装php memcached扩展
- Centos 下PHP编译安装fileinfo扩展
- CentOS系统安装Redis及Redis的PHP扩展
- CentOS系统安装Redis及Redis的PHP扩展
- Ubuntu下安装redis及php扩展
- centos手动编译安装apache、php、mysql、redis扩展
- 【PHP扩展】centos给PHP安装扩展
- 给PHP安装Redis扩展
- centos 安装php扩展redis
- windows下安装redis及php安装redis扩展教程
- Windows下redis及php-redis扩展的安装
- centos下编译php扩展
- centos下编译php扩展
- UICollectionView详解+实例
- 并发-CAS原则
- HashMap 实现原理
- jquery版本之间的冲突
- 编译不通过 illegal character: 65279
- Centos下给php安装Redis扩展及编译问题解决
- Jackson使用PropertyNamingStrategy处理属性首字母为大写的情况
- 深入理解Linux修改hostname
- js封装下拉框,实现重复利用
- 递归算法简单题
- mongodb-window安装与使用
- 使用nginx实现http访问自动跳转到https端口
- ajax对象的获取及其常用属性
- swift 基础(二)闭包、对象和类、setter&getter