这个问题之前就遇到过,记得最后是通过下载源码包来指定路径的,今天又从新安装环境结果一定要试试,因为我知道只要安装这种libmemcached-devdev包就一定有头文件,结果最后通过查询资料真的让我找到了,以下记录这个过程
首先安装依赖以编译安装sudo apt-get install libmemcached libmemcached-devpecl download memcached
tar zxvf memcached.tar.gz
cd memcached
phpize./configure --with-libmemcached-dir=这个目录可使用如下命令查找123456
dpkg -L libmemcached-dev | grep memcached.h/usr/include/libmemcached-1.0/memcached.hpp
/usr/include/libmemcached-1.0/struct/memcached.h
/usr/include/libmemcached-1.0/memcached.h
/usr/include/libmemcached/memcached.hpp
/usr/include/libmemcached/memcached.h12345
这样明明看到了memcached.h文件了,那么路径就写成/usr/include/libmemcached可是不行,保错./configure --with-libmemcached-dir=/usr/include/libmemcached
checking for libmemcached location... configure: error: Unable to find memcached.h under /u/weiz/libmemcached-1.0.16123
通过查看
https://github.com/php-memcached-dev/php-memcached/blob/master/config.m4#L277
可以看到
if test ! -f "$PHP_LIBMEMCACHED_DIR/include/libmemcached/memcached.h";
原来他要去这个路径include/libmemcached/下寻找,难怪出错
接下来执行sudo mkdir -p /usr/lib/x86_64-linux-gnu/include/libmemcached
sudo ln -s /usr/include/libmemcached/memcached.h /usr/lib/x86_64-linux-gnu/include/libmemcached/memcached.h12
接下来在执行就好了sudo ./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcached --with-libmemcached-dir=/usr/lib/x86_64-linux-gnu --disable-memcached-saslsudo make
sudo make install