zoukankan      html  css  js  c++  java
  • CentOS7配置php7.0支持redis

    配置之前应该是环境已经搭好了,phpinfo的页面可以加载出来。

    使用git clone下载git上的phpredis扩展包

    [root@VM_103_117_centos ]#git clone  https://github.com/phpredis/phpredis.git

    到了这一步,我们要使用安装php时生成的phpize来生成configure配置文件,

    //具体用哪个要取决于你的phpize文件所在的目录,这时你应该用 whereis phpize 来查看路径

    [root@VM_103_117_centos phpredis]# whereis phpize
    phpize: /usr/bin/phpize /usr/share/man/man1/phpize.1.gz

    这里表明路径为/usr/bin/phpize,然后执行:

    [root@VM_103_117_centos phpredis]# /usr/bin/phpize
    Can't find PHP headers in /usr/include/php
    The php-devel package is required for use of this command.

    这里报错了,原因是没有安装好php-devel,由于我是使用的php7.0所以执行以下命令:

    [root@VM_103_117_centos phpredis]#yum -y install php70w-devel

    然后再次执行:

    [root@VM_103_117_centos phpredis]# /usr/bin/phpize
    Configuring for:
    PHP Api Version: 20151012
    Zend Module Api No: 20151012
    Zend Extension Api No: 320151012

    执行完上一步,我们就有了 configure 配置文件了,接下来配置

    [root@VM_103_117_centos phpredis]#./configure

    或者执行

    [root@VM_103_117_centos phpredis]#./configure --with-php-config=/usr/bin/php-config

    接下来是编译安装

    [root@VM_103_117_centos phpredis]#make 

    [root@VM_103_117_centos phpredis]# make install
    Installing shared extensions: /usr/lib64/php/modules/

    配置php的配置文件php.ini(具体放在那里可以用 whereis php.ini 来查看),我的配置文件php.ini在/etc/下

    [root@VM_103_117_centos phpredis]#vim /etc/php.ini

    加入下面几行:

    [redis]
    extension_dir =/usr/lib64/php/modules/
    extension = redis.so

    redis.so文件的路径可以在make install的时候看到

    重启apache服务器,使配置生效

    [root@VM_103_117_centos phpredis]#systemctl restart httpd.service

    重启之后我们打开info.php,已经可以看到redis的扩展信息了

     

  • 相关阅读:
    2018第九届蓝桥杯C/C++ B国赛 —— 第三题:格雷码
    数据结构和算法 —— 谈谈算法
    数据结构和算法 —— 谈谈算法
    数据结构和算法 —— 绪论
    数据结构和算法 —— 绪论
    2018第九届蓝桥杯C/C++ B国赛 —— 第二题:激光样式
    2018第九届蓝桥杯C/C++ B国赛 —— 第二题:激光样式
    2018第九届蓝桥杯C/C++ B国赛 —— 第一题:换零钞
    围棋
    恶搞造句
  • 原文地址:https://www.cnblogs.com/liuboswu/p/7722947.html
Copyright © 2011-2022 走看看