Windows 下Memcache安裝配置

2021-06-02 00:33:19 字數 1267 閱讀 6069

詳細說明:

1.解壓縮到某個路徑下,這裡我放到d:\memcached1.2.4

2.通過命令列安裝,首先進入該目錄下,輸入memcached.ext -d install

3.上一步不出意外的話,就安裝成功了。那麼就可以啟動了。同樣的輸入memcached.exe -d start

4.ok,現在可以看看你的任務管理器有沒有乙個memcached.exe的程序了

讓php載入memcache

很簡單。不過還沒完,你只是安裝了乙個memcached caching server,還沒有和php建立關聯。所以在php程式裡還不能運用。

安裝與平時新增擴充套件完全一樣,把dll檔案拷到你的php目錄的ext目錄下,然後,

在php.ini中新增extension=php_memcache.dll,重啟伺服器,在phpinfo裡面就應該可以看到配置資訊,如下:

測試memcache

1

<?php

2$mem = new memcache;

3$mem->connect('127.0.0.1', 11211);

4$mem->set('key', 'this is a test!', 0, 60);

5$val = $mem->get('key');

6echo

$val; //

output this is a test!

7echo '';8

echo '我的memcache版本:'.$mem->getversion();//

output 1.2.4

9 ?>

注意:第2行部分,connect裡面的引數第乙個表示伺服器位址,第二個表示埠號,具體函式詳細說明可以檢視這裡。

提出問題,及解決

還是第2行,第乙個引數是ip位址,所以,嘗試用localhost試了下,結果,提示memcache_connect() [function.memcache-connect]: can』t connect to localhost:11211

google了下,這裡需要更改hosts檔案,新增一行127.0.0.1       localhost,如果已經存在了,只需要把#去掉就行。

這樣你可以再試試看,就可以了。

PHP Windows下使用Memcached擴充套件

github上發現了乙個很好用的小檔案,能夠 模擬出php memcached.dll的php memcached擴充套件。php memcached client 已知pcel有兩個memcache client的擴充套件,乙個是memcache,乙個是memcached,他們的實現方式不同,後者...

CentOS 下安裝編譯安裝MeMcached

tar xvf memcached 1.4.15.tar.gz cd memcached 1.4.15 configure prefix usr local memcache 出現了 configure error libevent is required.you can get it from t...

eAccelerator與memcached的區別

歡迎各位加入群 206981178,共同學習 eaccelerator和memcached,是目前較為主流的兩個可使用在php之中的快取加速工具.eaccelerator專門為php開發,而memcached不僅僅用在php之中,其他所有的語言都可以使用.eaccelerator的主要功能 1.快取...