編譯php-memcached 擴充時候遇到的問題Unable to find memcached.h

來源:互聯網
上載者:User

這個問題之前就遇到過,記得最後是通過下載源碼包來指定路徑的,今天又從新安裝環境結果一定要試試,因為我知道只要安裝這種libmemcached-devdev包就一定有標頭檔,結果最後通過查詢資料真的讓我找到了,以下記錄這個過程

首先安裝依賴以編譯安裝

sudo apt-get install libmemcached libmemcached-devpecl download memcachedtar zxvf memcached.tar.gzcd memcachedphpize./configure --with-libmemcached-dir=這個目錄可使用如下命令尋找

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.h

這樣明明看到了memcached.h檔案了,那麼路徑就寫成/usr/include/libmemcached可是不行,保錯

./configure --with-libmemcached-dir=/usr/include/libmemcachedchecking for libmemcached location... configure: error: Unable to find memcached.h under /u/weiz/libmemcached-1.0.16

通過查看
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/libmemcachedsudo ln -s /usr/include/libmemcached/memcached.h /usr/lib/x86_64-linux-gnu/include/libmemcached/memcached.h

接下來在執行就好了

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 makesudo make install
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.