设为首页 收藏本站
查看: 550|回复: 0

[经验分享] php 安装redis,protobuf,mcryp扩展

[复制链接]

尚未签到

发表于 2018-11-2 11:50:29 | 显示全部楼层 |阅读模式
  测试机上测试一些数据需要用到redis扩展,偷懒yum安装的php,以前yum install php-pecl-redis.x86_64可以安装扩展,这次找不到安装包,不折腾手动安装下。
  1.下载phpredis
  cd /usr/local/src
  wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
  tar -zxvf 2.2.4.tar.gz
  cd phpredis-2.2.4/
  2.用phpize生成configure配置文件
  /usr/bin/phpize  #会生成几个新文件,默认安装路径自定义的按照自定义路径;
  ./configure --with-php-config=/usr/bin/php-config
  make #编译
  make install #安装
  make test #测试
  3.配置php支持
  vim /usr/local/php/etc/php.ini #编辑配置文件,在最后一行添加以下内容
  extension="redis.so"
  4.
  重启http加载查看phpinfo信息:
  redis
  Redis Supportenabled
  Redis Version2.2.4
  成功!
  php扩展Protobuf
  下载protobuf扩展包:wget https://github.com/allegro/php-protobuf/archive/master.zip这个master.zip会报错;
  master.zip
  cd /home/tools/php-protobuf-master/
  phpize
  可能会报错php-devel
  yum install php-devel
./configuremake && make install  If you ever happen to want to link against installed libraries
  in a given directory, LIBDIR, you must either use libtool, and
  specify 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 `LD_LIBRARY_PATH' environment variable
  during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
  during linking
  - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'
  See any operating system documentation about shared libraries for
  more information, such as the ld(1) and ld.so(8) manual pages.
  ----------------------------------------------------------------------
  Build complete.
  Don't forget to run 'make test'.
  Installing shared extensions:     /usr/lib64/php/modules/
  然后再php.ini增加
  extension = protocolbuffers.so
  重启下http就可以了;
  装载protobuff库:
  pear channel-discover pear.pollinimini.net
  pear install drslump/Protobuf-beta
  mcryp扩展:
  yum install libmcrypt libmcrypt-devel mcrypt mhash 如果报错找不到补丁的话手动安装;
  下载Libmcrypt,mhash,mcrypt安装包
  Libmcrypt(libmcrypt-2.5.8.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91774&release_id=487459
  mcrypt(mcrypt-2.6.8.tar.gz ):http://sourceforge.net/project/showfiles.php?group_id=87941&package_id=91948&release_id=642101
  mhash(mhash-0.9.9.9.tar.gz):http://sourceforge.net/project/showfiles.php?group_id=4286&package_id=4300&release_id=645636
  2.先安装Libmcrypt
  tar -zxvf libmcrypt-2.5.8.tar.gz
  cd libmcrypt-2.5.8
  ./configure
  make
  make install
  说明:libmcript默认安装在/usr/local
  3.再安装mhash
  tar -zxvf mhash-0.9.9.9.tar.gz
  cd mhash-0.9.9.9
  ./configure
  make && make install
  4.最后安装mcrypt
  tar -zxvf mcrypt-2.6.8.tar.gz
  cd mcrypt-2.6.8
  LD_LIBRARY_PATH=/usr/local/lib ./configure
  make && make install
  说明:由于在配置Mcrypt时,会找不到libmcrypt的链接库,导致无法编译,因为Libmcrypt的链接库在/usr/local/lib文件夹下。
  因次,在配置mcrypt时要加入LD_LIBRARY_PATH=/usr/local/lib导入键接库。
  到http://cn.php.net/releases/ 网页下找到自己对应php版本,下载后解压
  cd php-5.4.16/ext/mcrypt/
  phpize (执行phpize命令(phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,如果没有?yum install php-devel)
  phpize
  Configuring for:
  PHP Api Version:         20100412
  Zend Module Api No:      20100525
  Zend Extension Api No:   220100525
  yum 安装php./configure就可以,定制的需要自己的路径如比:./configure --with-php-config=/usr/bin/php-config
  ./configure
  make && make install
  Libraries have been installed in:
  /home/tools/php-5.4.16/ext/mcrypt/modules
  If you ever happen to want to link against installed libraries
  in a given directory, LIBDIR, you must either use libtool, and
  specify 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 `LD_LIBRARY_PATH' environment variable
  during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
  during linking
  - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'
  See any operating system documentation about shared libraries for
  more information, such as the ld(1) and ld.so(8) manual pages.
  ----------------------------------------------------------------------
  Build complete.
  Don't forget to run 'make test'.
  Installing shared extensions:     /usr/lib64/php/modules/
  php.ini添加一条extension=mcrypt.so
  extension = protocolbuffers.so
  extension = mcrypt.so



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-629812-1-1.html 上篇帖子: elkb+redis建立日志收集分析系统 下篇帖子: Redis无法写入故障排查过程
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表