libmemcached下載地址
https://launchpad.net/libmemc...php
php-memcached下載地址 (PHP5.6選擇2.2.0版本,PHP7選擇3.X版本)
http://pecl.php.net/package/m...ide
mkdir -p /usr/local/libmemcached tar zxvf libmemcached-1.0.18.tar.gz cd libmemcached-1.0.18 ./configure --prefix=/usr/local/libmemcached --with-memcached make && make install
注:涉及建立文件夾及寫入文件等操做,需有對應權限,本文其餘地方再也不贅述。memcached
mkdir -p /usr/local/phpmemcached tar zxvf memcached-2.2.0.tgz cd memcached-2.2.0 /Applications/XAMPP/xamppfiles/bin/phpize Configuring for: PHP Api Version: 20131106 Zend Module Api No: 20131226 Zend Extension Api No: 220131226 ./configure --enable-memcached --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached make && make install Installing shared extensions:/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226 # 而後修改PHP配置文件,添加memcached.so,而後重啓Apache便可 vi /Applications/XAMPP/xamppfiles/etc/php.ini #添加 extension=memcached.so
根據PHP版本選擇對應的擴展(PHP7選擇3.X,PHP2-6選擇2.X版本)
安裝libmemcached過程當中不要忘了,–with-memcached
文件寫入權限
編譯libmemcached時遇到下面錯誤.net
libmemcached/byteorder.cc:66:10: error: use of undeclared identifier 'ntohll' return ntohll(value); libmemcached/byteorder.cc:75:10: error: use of undeclared identifier 'htonll' return htonll(value);
能夠按下面步驟修改便可debug
編輯libmemcached/byteorder.cc文件code
sudo vi libmemcached/byteorder.c,在 #include "libmemcached/byteorder.h" 下面增長,如下內容:server
#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif
保存退出get
configure時報錯it
clients/memflush.cc:42:19: error: comparison between pointer and integer ('char *' and 'int') if (opt_servers == false) ~~~~~~~~~~~ ^ ~~~~~ clients/memflush.cc:51:21: error: comparison between pointer and integer ('char *' and 'int') if (opt_servers == false) ~~~~~~~~~~~ ^ ~~~~~
編輯clients/memflush.cc
sudo vi clients/memflush.cc,將兩處if(opt_servers == false)裏面的false改成NULLio