Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos install memcache

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Before installing Memcached, you need to install libevent. First, download libevent with wget:

Wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

Tar zxf libevent-1.4.13-stable.tar.gz

Cd libevent-1.4.13-stable

. / configure

Make & & make install

two。 Install Memcached

Tar zxf memcached-1.4.5.tar.gz

. / configure

Make & & make install

3. Start Memcached

/ usr/local/bin/memcached-m 32m-p 11211-d-u root-P / var/run/memcached.pid-c 256

Description of the options used during startup:

The TCP port used by Q-p. The default is 11 211

Q-m maximum memory size. Default is 64MB

Q-vv starts in very vrebose mode, and debug information and errors are output to the console

Q-d runs in the background as a daemon

Q-c maximum number of concurrent connections running. Default is 1024, which is set according to the load of the server.

Q-P setting saves the pid file of Memcache

The IP address of the server that Q-l listens to, if there is more than one address

Q-u users running Memcached cannot be started by root users by default, so when the current user is a root user, it needs to be specified with the-u parameter.

There are many other options, and the "/ usr/local/bin/memcached-h" command displays all available options.

4. Test whether the connection is normal

5. Install the PHP extension for Memcache

Wget-b http://pecl.php.net/get/memcache-2.2.5.tgz

Tar zxf memcache-2.2.5.tgz

Cd memcache-2.2.5

/ usr/local/webserver/php/bin/phpize

. / configure\

-- enable-memcache\

-- with-php-config=/usr/local/webserver/php/bin/php-config

Make & & make install

Modify the php.ini file to change the extension_dir in php.ini to ". /"

Change to extension_dir = "/ usr/local/webserver/php/lib/php/extensions/no-debug-zts-20060613/"

Add the following line to load the Memcache extension:

Extension=memcache.so

Restart php

6. Test whether the PHP extension for Memcache is installed successfully

Run the following PHP code, and if you output Hello worldview, the environment is set up successfully.

< ?php $mem = new Memcache; $mem->

Connect ('127.0.0.1 percent, 11211)

$mem- > set ('test',' Hello worldview, 0,12)

$val = $mem- > get ('test')

Echo $val

? >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report