Install and verify memcached and memcached
1. Install libevent
Down: http://www.monkey.org
My online drive down: http://pan.baidu.com/s/1qW8syZi
[Root @ luozhonghua memcachedsource] # tar-zxvf libevent-1.4.13-stable.tar.gz
[Root @ luozhonghua memcachedsource] # cd libevent-1.4.13-stable
[Root @ luozhonghua memcachedsource] #./configure -- prefix =/usr
[Root @ luozhonghua memcachedsource] # make & make install
#./Configure -- prefix =/usr & make install
Pay attention to specifying -- prefix, which will be necessary when memcached is configured later.
2 install memcached
Down: http://www.monkey.org
My online drive down: http://pan.baidu.com/s/1qW8syZi
[Root @ luozhonghua memcachedsource] # tar-zxvf memcached-1.4.5.tar.gz
[Root @ luozhonghua memcachedsource] # cd memcached-1.4.5
[Root @ luozhonghua memcached-1.4.5] #./configure -- with-libevent =/usr/lib
[Root @ luozhonghua memcached-1.4.5] # make & make install
#./Configure -- with-libevent =/usr/lib & make install
You must specify the libevent path here. Otherwise, the so file cannot be found at startup!
3> Start memcached
#/Usr/local/bin/memcached-m 32 m-p 11211-d-u root-P/var/run/memcached. pid-c 256-vv
/Usr/local/bin/memcached-d-m 512-p 11211-u root-c 256-P/var/run/memcached. pid
4> disable memcached
Kill-9 'cat/var/run/memcached. Pi'
Note: If the value of 'cat/var/run/memcached. Pi' is cached last time, the pid value = 7787 can be directly found.
5> Test
5.1> telnet 127.0.0.1 11211
5.2> stats
Stats
STAT pid 7787
Statuptime 470
STAT time 1405273052
STAT version 1.4.5
STAT pointer_size 32
STAT rusage_user 0.002999
STAT rusage_system 0.101984
STAT curr_connections 10
STAT total_connections 12
STAT connection_structures 11
STAT performance_get 0
STAT performance_set 0
STAT 1__flush 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 27
STAT bytes_written 49
STAT limit_maxbytes 536870912
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END
6. Exit
Quit
Install the memcached extension of PHP in linux
First, determine whether it is memcache or memcached.
Telnet successfully proves that memcache is successfully installed.
Phpinfo shows memcached, Which is okay.
But you said
It is useless to use the official PHP file for memcached testing. The Error 500 is displayed on the page.
I wonder if you are using such code.
<? Php
$ Mem = new Memcache;
$ Mem-> connect ("192.168.x.y", 11211) or die ("cocould not connect ");
$ Mem-> set ('key', 'This is a test! ', 0, 60 );
$ Val = $ mem-> get ('key ');
Echo $ val;
?>
Pay attention to the first line .. $ Mem = new Memcache;
If your server supports memcached, memcached is displayed in phpinfo.
For memcache, only memcache is displayed.
Memcached is an extension of php.
Therefore, if you use new memcache To Go To The instance memcached, it will take 500 of the total output.
CentOS6 Memcached cannot be automatically started upon startup. How can I manually enable the discuz Memca?
In a daze, reply, and end of work ~ View Original post>