安裝memcached及php擴充

來源:互聯網
上載者:User
用的是centos系統

1、安裝memcached

yum -y install memcached

安裝完成後,

memcached -h

應該會出現memcached 參數說明

2、memcached設定檔

vi /etc/sysconfig/memcached PORT="11210"USER="memcached"MAXCONN="1024"CACHESIZE="64"OPTIONS=""

3、安裝libmemached

wget tar -zxvf libmemcached-1.0.16.tar.gzcd libmemcached-1.0.16./configure -prefix=/usr/local/libmemcached -with-memcached make && make install

這步出現了兩個錯誤

第一個gcc錯誤,因為本地用的centos最小安裝

yum -y install gcc+ gcc-c++

第二個錯誤是libmemcached版本錯誤,下載了 libmemcached-1.0.18.tar.gz 和 libmemcached-1.0.17.tar.gz

都會出錯,最後安裝1.6版本的才可以

4、 php-devel

yum install php-devel

5、 安裝PHP Memcached擴充

wget tar -zxvf memcached-2.2.0.tgzcd  memcached-2.2.0/usr/local/php/bin/phpize ./configure -enable-memcached --disable-memcached-sasl -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached make && make install

中間可能會出現一個錯誤:memcache support requires ZLIB

yum install zlib-devel

6、增加擴充extension設定檔

vi /etc/php.d/memcached.ini extension=memcached.so #增加這行

檢測是否安裝

php -m|grep memcached

會出現"memcached"

7、啟動memcached

/usr/bin/memcached -m 64m -p 11211 -d -u root -P /var/run/memcached.pid -c 256

最後可以用phpinfo();

應該會出現在 memcached

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.