Home > Backend Development > PHP Tutorial > Debian installs memcached and php5-memcache modules

Debian installs memcached and php5-memcache modules

巴扎黑
Release: 2016-11-10 10:02:42
Original
1182 people have browsed it

1. Install memcached service and php extension
apt-get install memcached php5-memcached php5-memcache

2. Check whether the memcached service is installed
ps aux | grep memcached
You can find that memcached starts automatically after installation. You can also view it with the following command:
netstat -tap | grep 'memcached'

3. If you need to modify the configuration file
please go to: /etc/memcached.conf
Restart after modification
pkill memcached
/usr/bin/memcached restart - p 11211 -u nobody -l 127.0.0.1
It is best to find a shell script on the Internet, you can directly memcache start

4. Finally, restart the web server, use fast-cgi of apache or nginx
/etc/init.d/apache2 restart

Debian installs memcached and php5-memcache modules

Finally let’s take a simple example:

$mem = newMemcache;

$mem->connect("localhost",11211);

$mem->set('test', 'hello world',0,60);

echo $mem->get('test');

If you can see the hello word, it's really ok.


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