memcached安裝和php擴充memcache安裝

來源:互聯網
上載者:User

標籤:memcached安裝和php擴充memcache安裝

1.準備安裝包:

libevent-2.1.8-stable.tar.gz

memcached-1.5.0.tar.gz

memcache-2.2.7.tgz 


2.安裝libevent

tar xf /opt/libevent-2.1.8-stable.tar.gz 

cd libevent-2.1.8-stable

mkdir /usr/local/libevent 

./configure --prefix=/usr/local/libevent

make && make install

echo $?


3.安裝memcached

tar xf memcached-1.5.0.tar.gz -C /opt/

mkdir /usr/local/memcached

cd /opt/memcached-1.5.0

./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent

make && make install

id www


memcached參數

-d  選項是啟動一個守護進程,

-m  是分配給Memcache使用的記憶體數量,單位是MB

-u  是運行Memcache的使用者,如果當前為 root 的話,需要使用此參數指定使用者。

-l  是監聽的伺服器IP地址

-p  是設定Memcache監聽的連接埠, 最好是1024以上的連接埠

-c  是最大啟動並執行並發串連數,預設是1024

-P 是設定儲存Memcache的pid檔案,我這裡是儲存在 /tmp/memcached.pid


4.普通使用者啟動memcached:

/usr/local/memcached/bin/memcached -d -u www -m 4096 -l 127.0.0.1 -c 10000 -p 11313 -P /tmp/11313.pid


5.檢查服務:

[[email protected] memcached-1.5.0]# netstat -lp | grep memcached

tcp        0      0 localhost:11313             *:*                         LISTEN      19688/memcached     

udp        0      0 localhost:11313             *:*                                     19688/memcached 


6.安裝php擴充memcache


tar xf /opt/memcache-2.2.7.tgz -C /opt/

cd /opt/memcache-2.2.7

find / -name "php-config"

/usr/local/php/bin/phpize

./configure --enable-memcache=/usr/local/memcached --with-php-config=/usr/local/php/bin/php-config 

make &&make install


[[email protected] vhost]# tail -2 /usr/local/php/etc/php.ini 

[memcache]

extension = memcache.so

[[email protected] vhost]# tail -2 /usr/local/php/etc/php.ini 

[memcache]

extension = memcache.so


7.測試:

cat test.php

<?php

phpinfo()

?>


本文出自 “10931853” 部落格,請務必保留此出處http://wujianwei.blog.51cto.com/10931853/1961541

memcached安裝和php擴充memcache安裝

相關文章

聯繫我們

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