/ 学习笔记 / 13浏览

宝塔PHP安装扩展memcached失败

文章目录
  • 安装过程
  • 使用宝塔自带的php扩展安装功能,安装memcached失败,截取报错信息最后一段:

    checking whether to enable memcached msgpack serializer support... no
    checking whether to enable memcached sasl support... yes
    checking whether to enable memcached protocol support... no
    checking whether to use system FastLZ library... no
    checking for ZLIB... yes, shared
    checking for pkg-config... /bin/pkg-config
    checking for zlib location... /usr
    checking for session includes... /www/server/php/82/include/php
    checking for memcached session support... enabled
    checking for memcached igbinary support... disabled
    checking for memcached msgpack support... disabled
    checking for libmemcached location... configure: error: Unable to find memcached.h under /usr/local/libmemcached
    make: *** No targets specified and no makefile found. Stop.
    Install failed

    关键信息是后面这一句:

    checking whether to enable memcached msgpack serializer support... no
    checking whether to enable memcached sasl support... yes
    checking whether to enable memcached protocol support... no
    checking whether to use system FastLZ library... no
    checking for ZLIB... yes, shared
    checking for pkg-config... /bin/pkg-config
    checking for zlib location... /usr
    checking for session includes... /www/server/php/82/include/php
    checking for memcached session support... enabled
    checking for memcached igbinary support... disabled
    checking for memcached msgpack support... disabled
    checking for libmemcached location... configure: error: Unable to find memcached.h under /usr/local/libmemcached
    make: *** No targets specified and no makefile found. Stop.
    Install failed

    意思是在/usr/local/libmemcached这个路径下找不到memcached.h文件。

    我看了下确实没有这个目录,使用yum命令安装了libmemcachedlibmemcached-devel依然没有这个目录。

    看到网上说需要编译安装,而且yum上的版本只到1.0.16,最新版是1.0.18,我也不清楚是安装方式的问题还是版本的问题,但是我通过编译安装1.0.18版本的libmemcached后,问题解决了。

    安装过程

    获取源码包

    可以通过wget下载,但我安装的时候这个网站超时响应。

    wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

    也可以到这个网站直接下载:https://launchpad.net/libmemcached/+download

    解压

    tar -xzvf libmemcached-1.0.18.tar.gz

    此处如果解压参数给的是zxvf的话,会遇到报错

    tar: Old option 'f' requires an argument

    顺便温习一下Linux的tar指令

    编译安装

    # 进入目录
    cd libmemcached-1.0.18
    
    # 配置libmemcached和memcached的安装路径
    ./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached
    
    # 编译安装
    make && make install

    安装完成后可以在/usr/local目录下看到libmemcached文件夹啦。

    然后就是使用宝塔的php扩展安装功能,即可成功装上memcached扩展。

    Linux系统用户最小化检测方法
    企业采购模式扫盲
    安卓APP渗透基础 —— APK安装包的签名机制
    安卓APP渗透基础 —— 四大组件暴露测试
    安卓APP渗透基础 —— APK文件结构
    《CCNA认证指南》“IP地址”知识点整理

    0

    1. This post has no comment yet

    发表回复

    您的邮箱地址不会被公开。 必填项已用 * 标注