Compile and install the memcached service instance tutorial in linux and the memcached instance tutorial
Let's take a look at how to compile and install the memcached service in linux.
System: Ubuntu 13.10
Step 1: Install libevent-dev
$ Aptitude search libevent-dev
$ Aptitude install libevent-dev
Step 2: download and install memcached (www.jbxue.com)
Official website address: http://memcached.org/
$ Wget-c http://www.memcached.org/files/memcached-1.4.17.tar.gz
$ Tar-zxvf memcached-1.4.17.tar.gz
$ Memcached-1.4.17 cd
$./Configure -- prefix =/usr/local/memcached
$ Make
$ Sudo make install
Step 3: Start memcached
$ Cd/usr/local/memcached
$./Memcached-d-m 1024-u root-l 127.0.0.1-p 11211-P/tmp/memcached. pid
Step 3: Check whether the installation is successful
$ Ps-aux | grep memcache # method 1
$ Netstat-antu | grep 11211 # method 2
$ Telnet localhost 11211 # method 3
Refer:
How to install memcache in ubuntu
Linux memcache installation and configuration tutorial
Common commands
Start memcached Service
#./Memcached-d-m 1024-u root-l 127.0.0.1-p 11211-P/tmp/memcached. pid
Disable memcached Service
# Kill 'cat/tmp/memcached. Pi'
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.
I used to install memcached in linux in java. Now I have installed memcached on windows.
Use telnet to connect to the memcached listener port on the computer where windows is located to see if it can be connected.