博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MAC下PHP拓展Redis插件
阅读量:2222 次
发布时间:2019-05-08

本文共 8286 字,大约阅读时间需要 27 分钟。

下载安装phpredis拓展

github下载phpredis拓展项目:

git clone https://github.com/phpredis/phpredis.git

或下载稳定版本:

http://pecl.php.net/package/redis

解压(稳定版):

bogon:~ Brave$ tar xzf redis-3.1.4.tgz

tgz

cd 到redis-3.1.4目录下

bogon:~ Brave$ cd redis-3.1.4

执行sudo /Applications/XAMPP/xamppfiles/bin/phpize

bogon:redis-3.1.4 Brave$ sudo /Applications/XAMPP/xamppfiles/bin/phpizePassword:Configuring for:PHP Api Version:         20131106Zend Module Api No:      20131226Zend Extension Api No:   220131226Cannot find autoconf. Please check your autoconf installation and the$PHP_AUTOCONF environment variable. Then, rerun this script.

安装遇到问题:$PHP_AUTOCONF environment variable. Then, rerun this script.

Error: Could not link:/usr/local/share/doc/homebrewPlease delete these paths and run `brew update`./usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `
': Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)

删除/usr/local/share/doc/homebrew,重新更新brew

bogon:~ Brave$ brew updateUpdated 1 tap (homebrew/core).==> Updated Formulaeabcm2ps         bacula-fd       gitlab-runner   lldpd           tippecanoearmadillo       bmake           kompose         remake          zimg

安装autoconf,提示缺少xcode-select

bogon:~ Brave$ brew install autoconfError: Xcode alone is not sufficient on Yosemite.Install the Command Line Tools:  xcode-select --install

安装xcode-select –install,弹出Xcode,等待安装完成

再次安装autoconf:

bogon:~ Brave$ brew install autoconfUpdating Homebrew...==> Auto-updated Homebrew!Updated 1 tap (homebrew/core).==> Updated Formulaeclhep           firebase-cli    fonttools       ibex            iso-codes==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.yosemite.bott######################################################################## 100.0%==> Pouring autoconf-2.69.yosemite.bottle.4.tar.gz

再次sudo /Applications/XAMPP/xamppfiles/bin/phpize

bogon:~ Brave$ cd redis-3.1.4bogon:redis-3.1.4 Brave$ sudo /Applications/XAMPP/xamppfiles/bin/phpizePassword:Configuring for:PHP Api Version:         20131106Zend Module Api No:      20131226Zend Extension Api No:   220131226

运行./configure -with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config

bogon:redis-3.1.4 Brave$ ./configure -with-php-config=/Applications/XAMPP/xamppfiles/bin/php-configchecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking for a sed that does not truncate output... /usr/bin/sedchecking for cc... ccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables... checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether cc accepts -g... yeschecking for cc option to accept ISO C89... none neededchecking how to run the C preprocessor... cc -Echecking for icc... nochecking for suncc... nochecking whether cc understands -c and -o together... yeschecking for system library directory... libchecking if compiler supports -R... nochecking if compiler supports -Wl,-rpath,... yeschecking build system type... x86_64-apple-darwin14.5.0checking host system type... x86_64-apple-darwin14.5.0checking target system type... x86_64-apple-darwin14.5.0checking for PHP prefix... /Applications/XAMPP/xamppfileschecking for PHP includes... -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/libchecking for PHP extension directory... /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226checking for PHP installed headers prefix... /Applications/XAMPP/xamppfiles/include/phpchecking if debug is enabled... nochecking if zts is enabled... nochecking for re2c... noconfigure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.checking for gawk... nochecking for nawk... nochecking for awk... awkchecking if awk is broken... nochecking whether to enable redis support... yes, sharedchecking whether to enable sessions... yeschecking whether to enable igbinary serializer support... nochecking for redis igbinary support... disabledchecking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ldchecking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... nochecking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -rchecking for BSD-compatible nm... /usr/bin/nmchecking whether ln -s works... yeschecking how to recognize dependent libraries... pass_allchecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking dlfcn.h usability... yeschecking dlfcn.h presence... yeschecking for dlfcn.h... yeschecking the maximum length of command line arguments... 196608checking command to parse /usr/bin/nm output from cc object... okchecking for objdir... .libschecking for ar... archecking for ranlib... ranlibchecking for strip... stripchecking for dsymutil... dsymutilchecking for nmedit... nmeditchecking for -single_module linker flag... yeschecking for -exported_symbols_list linker flag... yeschecking if cc supports -fno-rtti -fno-exceptions... yeschecking for cc option to produce PIC... -fno-commonchecking if cc PIC flag -fno-common works... yeschecking if cc static flag -static works... nochecking if cc supports -c -o file.o... yeschecking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yeschecking dynamic linker characteristics... darwin14.5.0 dyldchecking how to hardcode library paths into programs... immediatechecking whether stripping libraries is possible... yeschecking if libtool supports shared libraries... yeschecking whether to build shared libraries... yeschecking whether to build static libraries... nocreating libtoolappending configuration tag "CXX" to libtoolconfigure: creating ./config.statusconfig.status: creating config.h

编译make & make install

可能会出现错误:

make: *** [redis.la] Error 1bogon:redis-3.1.4 Brave$ libtool: link: `redis_session.lo' is not a valid libtool object

make clean一下

bogon:redis-3.1.4 Brave$ make cleanfind . -name \*.gcno -o -name \*.gcda | xargs rm -ffind . -name \*.lo -o -name \*.o | xargs rm -ffind . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -ffind . -name .libs -a -type d|xargs rm -rfrm -f libphp.la       modules/* libs/*[1]+  Exit 2                  make

重新编译sudo make install

/bin/sh /Users/Brave/redis-3.1.4/libtool --mode=install cp ./redis.la /Users/Brave/redis-3.1.4/modulescp ./.libs/redis.so /Users/Brave/redis-3.1.4/modules/redis.socp ./.libs/redis.lai /Users/Brave/redis-3.1.4/modules/redis.la----------------------------------------------------------------------Libraries have been installed in:   /Users/Brave/redis-3.1.4/modulesIf you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag during linking and do at least one of the following:   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable     during executionSee any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------Installing shared extensions:     /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/

此时/Users/Brave/redis-3.1.4/modules下的redis.so已复制到

/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/中


配置Php.ini

进入phpinfo页面找到Xampp下的php.ini位置

phpini

打开php.ini添加redis拓展配置

extension="redis.so"

重新启动Xampp,访问phpinfo查看redis插件

phpredis

phpinfo页面出现redis插件信息显示,说明redis插件安装成功

你可能感兴趣的文章
Leetcode C++《每日一题》20200626 338. 比特位计数
查看>>
Leetcode C++ 《拓扑排序-1》20200626 207.课程表
查看>>
Go语言学习Part1:包、变量和函数
查看>>
Go语言学习Part2:流程控制语句:for、if、else、switch 和 defer
查看>>
Go语言学习Part3:struct、slice和映射
查看>>
Go语言学习Part4-1:方法和接口
查看>>
Leetcode Go 《精选TOP面试题》20200628 69.x的平方根
查看>>
leetcode 130. Surrounded Regions
查看>>
【Python】详解Python多线程Selenium跨浏览器测试
查看>>
Jmeter之参数化
查看>>
Shell 和Python的区别。
查看>>
【JMeter】1.9上考试jmeter测试调试
查看>>
【虫师】【selenium】参数化
查看>>
【Python练习】文件引用用户名密码登录系统
查看>>
学习网站汇总
查看>>
【Loadrunner】性能测试报告实战
查看>>
【自动化测试】自动化测试需要了解的的一些事情。
查看>>
【selenium】selenium ide的安装过程
查看>>
【手机自动化测试】monkey测试
查看>>
【英语】软件开发常用英语词汇
查看>>