Home > Backend Development > PHP Tutorial > Compile and install memcached service under linux, linuxmemcached_PHP tutorial

Compile and install memcached service under linux, linuxmemcached_PHP tutorial

WBOY
Release: 2016-07-13 10:21:29
Original
912 people have browsed it

Compile and install the memcached service under linux, linuxmemcached

System: Ubuntu 13.10
Step 1: Install libevent-dev

$aptitude search libevent-dev
$aptitude install libevent-dev
Copy after login

Step 2: Download memcached and install it
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
$cd memcached-1.4.17
$./configure --prefix=/usr/local/memcached
$ make
$ sudo make install
Copy after login

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
Copy after login

Step 3: Check whether the installation is successful

$ps -aux | grep memcache #法1
$netstat -antu | grep 11211 #法2
$telnet localhost 11211 #法3
Copy after login

Common commands
Start memcached service

#./memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211 -P /tmp/memcached.pid
Copy after login

Close memcached service

#kill `cat /tmp/memcached.pid`
Copy after login

linux Install PHP’s memcached extension

First make sure there is a difference between memcache and memcached.
Telnet successfully proves that memcache is successfully installed.
phpinfo shows memcached, so that’s no problem

But you said
using the official PHP file to test memcached is useless, the page prompts a 500 error
I wonder if you are using something similar to this code.
$mem = new Memcache;
$mem->connect("192.168.x.y", 11211)or die ("Could 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 will be displayed in phpinfo
If it is memcache, only memcache will be displayed

memcached is php an extension of.
So if you use new memcache to instance memcached, it is normal that 500 will appear.

The memcached I installed in linux before is easy to use in java programs. Now I installed memcached on windows and the process already has memcached

First use telnet to connect to the open listening port of memcached on the computer where Windows is located to see if the connection can be made

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/856993.htmlTechArticleCompile and install the memcached service under linux, linuxmemcached system: Ubuntu 13.10 Step 1: Install libevent-dev $aptitude search libevent -dev$aptitude install libevent-dev Step 2: Download...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template