标签:redis
php扩展模块安装1.首先下载redis包并改名:
[root@weixing01 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
--2018-03-08 20:56:11-- https://codeload.github.com/phpredis/phpredis/zip/develop
正在解析主机 codeload.github.com (codeload.github.com)... 192.30.255.120, 192.30.255.121
正在连接 codeload.github.com (codeload.github.com)|192.30.255.120|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:未指定 [application/zip]
正在保存至: “develop”
[ <=> ] 230,093 105KB/s 用时 2.1s
2018-03-08 20:56:15 (105 KB/s) - “develop” 已保存 [230093]
[root@weixing01 src]# du -sh develop
228K develop
[root@weixing01 src]# mv develop phpredis-develop.zip
2.解压缩
[root@weixing01 src]# unzip phpredis-develop.zip
3.进入目录,并生成configure文件:
[root@weixing01 src]# cd phpredis-develop/
[root@weixing01 phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
报错,缺少一个包
4.安装autoconf包:
[root@weixing01 phpredis-develop]# yum install -y autoconf
已加载插件:fastestmirror
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 6.7 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/7/x86_64/primary_db
5.再次生成configure文件:成功
[root@weixing01 phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
[root@weixing01 phpredis-develop]# ls
acinclude.m4 config.h.in debian.control mkdeb.sh redis_cluster.c
aclocal.m4 config.m4 install-sh mkinstalldirs redis_cluster.h
arrays.markdown config.sub ISSUE_TEMPLATE.md package.xml redis_commands.c
autom4te.cache configure liblzf php_redis.h redis_commands.h
build configure.in library.c README.markdown redis_session.c
cluster_library.c config.w32 library.h redis_array.c redis_session.h
cluster_library.h COPYING ltmain.sh redis_array.h rpm
cluster.markdown crc16.h Makefile.global redis_array_impl.c run-tests.php
common.h CREDITS missing redis_array_impl.h serialize.list
config.guess debian mkdeb-apache2.sh redis.c tests
6.进行编译:
[root@weixing01 phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-configchecking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
[root@weixing01 phpredis-develop]# make
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis.c -o redis.lo
mkdir .libs
[root@weixing01 phpredis-develop]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@weixing01 phpredis-develop]# ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
opcache.so redis.so
7.查看配置文件存放位置:
[root@weixing01 phpredis-develop]# /usr/local/php/bin/php -i |grep -i extension_dir
PHP Warning: Unknown: It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC‘ for now, but please set date.timezone to select your timezone. in Unknown on line 0
extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 => /usr/local/php/lib/php/extensions/no-debug-zts-20131226
sqlite3.extension_dir => no value => no value
8.增加一行配置:
[root@weixing01 phpredis-develop]# vim /usr/local/php/etc/php.ini
extension = redis.so
9.测试:
[root@weixing01 phpredis-develop]# /usr/local/php/bin/php -m |grep redis
redis
标签:redis
原文地址:http://blog.51cto.com/13517254/2084382