Compile and install the memcached service instance tutorial in linux and the memcached instance tutorial

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.