php5-memcached和php5-memcache是兩個php操作memcached的元件,他們是不同人開發的。
php官網都列出了他們各自的使用方法:
1. 首先,先安裝下apache:
sudo apt-get update
sudo apt-get install apache2
2. 然後安裝下php5:
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
3. 接着安裝memcached:
sudo apt-get install memcached
4. 接着安裝php5-memcached和php5-memcache:
sudo apt-get install php5-memcache
sudo apt-get install php5-memcached
5. 最後重新開機下apache2:
sudo service apache2 restart
6.編輯test.php内容如下:
memcache vs memcached: 10000 keys
memcached set: 0.7015380859375
memcached get: 0.61220598220825
memcache set: 0.78830289840698
memcache get: 0.74954390525818
~
memcache set: 0.78771591186523
memcache get: 0.75219798088074
memcached set: 0.69968199729919
memcached get: 0.60679888725281
參考文檔:
1.https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu