您好,登錄后才能下訂單哦!
先安裝php的memcache擴展
# wget http://www.lishiming.net/data/p_w_upload/forum/memcache-2.2.3.tgz
# tar zxf memcache-2.2.3.tgz
# cd memcache-2.2.3
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make && make install
安裝完后會有類似這樣的提示:Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
把這個記住,然后修改php.ini,把 extension_dir = "./" 修改為extension_dir = "/usr/local/servers/php5/lib/php/extensions/no-debug-non-zts-20090626/"
或者指定新的位置,我以下是指定新的位置
并添加一行extension="memcache.so"
[root@localhost memcache-2.2.3]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
[root@localhost memcache-2.2.3]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
memcache.so
[root@localhost memcache-2.2.3]# vim /usr/local/php/etc/php.ini
[root@localhost memcache-2.2.3]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
memcache.so
將memcache.so拷貝到/usr/local/php/ext 下
[root@localhost memcache-2.2.3]# mkdir /usr/local/php/ext #創建目錄
[root@localhost memcache-2.2.3]# cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so /usr/local/php/ext/
[root@localhost memcache-2.2.3]# ls !$
ls /usr/local/php/ext/
memcache.so
添加路徑
[root@localhost memcache-2.2.3]# vim /usr/local/php/etc/php.ini
檢測添加memcached模塊是否添加成功
[root@localhost memcache-2.2.3]# /usr/local/php/bin/php -m|grep memcache
memcache
測試能否連接memcached
[root@localhost memcache-2.2.3]# curl www.apelearn.com/study_v2/.memcache.txt > 1.php 2>/dev/null
下載一個1.php文件
[root@localhost memcache-2.2.3]# /usr/local/php/bin/php 1.php
Get key1 value: This is first value<br>Get key1 value: This is replace value<br>Get key2 value: Array
(
[0] => aaa
[1] => bbb
[2] => ccc
[3] => ddd
)
<br>Get key1 value: <br>Get key2 value: <br>[root@localhost memcache-2.2.3]#
[root@localhost memcache-2.2.3]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
此時沒有生成configure文件。
解決方法:
# cd /usr/src # wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz # tar -zvxf m4-1.4.9.tar.gz # cd m4-1.4.9/ # ./configure && make && make install # cd ../ # wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz # tar -zvxf autoconf-2.62.tar.gz # cd autoconf-2.62/ # ./configure && make && make install
或者更簡單的辦法是: # yum install m4 # yum install autoconf
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。