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

How to install Memcache under CentOS5.4

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to install Memcache under CentOS5.4". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install Memcache under CentOS5.4.

I. Source package preparation

The server side is mainly to install the memcache server side, and the latest version is memcached-v1.4.4.

In addition, memcache uses libevent as a library for socket processing, so you also need to install libevent

The latest version of libevent is libevent-1.4.13-stable. (if your system already has libevent installed, you don't have to install it.)

Prepare the source installation package for memcached's php extension:

Download the linux instruction:

Wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz

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

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

II. Installation and configuration

1. Install libevent first

Tar zxvf libevent-1.4.13-stable.tar.gz

Cd libevent-1.4.13-stable

. / configure-- prefix=/usr

Make

Make install

2. Test whether libevent is installed successfully.

Ls-al / usr/lib | grep libevent

Libevent-1.1a.so.1

Libevent-1.1a.so.1.0.2

Libevent-1.4.so.2

Libevent-1.4.so.2.1.3

Libevent.a

Libevent_core-1.4.so.2

Libevent_core-1.4.so.2.1.3

Libevent_core.a

Libevent_core.la

Libevent_core.so

Libevent_extra-1.4.so.2

Libevent_extra-1.4.so.2.1.3

Libevent_extra.a

Libevent_extra.la

Libevent_extra.so

Libevent.la

Libevent.so

Depending on the version, the list of files may be different.

3. To install memcached, you need to specify the installation location of libevent in the installation

Tar zxvf memcached-1.4.4.tar.gz

Cd memcached-1.4.4

. / configure-with-libevent=/usr

Make & & make install

Memcached will be automatically placed in / usr/local/bin/memcached after installation is completed.

4. Test whether memcached is installed successfully.

Ls-al/ usr/local/bin/mem*

-rwxr-xr-x 1 root root 201869 12-14 21:44 / usr/local/bin/memcached

5. Install the php extension of memcache

① installs memcache extensions for php

Tar vxzf memcache-2.2.5.tgz

Cd memcache-2.2.5

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

. / configure-- enable-memcache-- with-php-config=/usr/local/php/bin/php-config-- with-zlib-dir

Make

Make install

After the above installation of ②, there will be a prompt similar to this:

Installing shared extensions: / usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/

③ modifies extension_dir = ". /" in php.ini to

Extension_dir = "/ usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/"

④ adds a line to load the memcache extension: extension=memcache.so

III. Basic settings of memcached

1. Start the server side of memcache:

Memcached-d-m 10-u root-l 202.207.177.177-p 11211-c 256-p / tmp/memcached.pid

Parameter description:

The-d option is to start a daemon

-m is the amount of memory allocated to memcache in mb, and this is 10mb.

-u is the user running memcache. This is root.

-l is the ip address of the listening server. If there are multiple addresses, I specify the ip address of the server 202.207.177.177.

-p is the port on which memcache snooping is set. I have set 11211 here, preferably a port above 1024.

The-c option is the maximum number of concurrent connections running. The default is 1024. I set it here according to the load of your server.

-p is the pid file that is set to save memcache. Here I save it in / tmp/memcached.pid

two。 To end the memcache process, execute:

Kill `cat / tmp/ Memcached.pid`

Multiple daemons can also be started, but the ports cannot be duplicated.

3. Check whether memcached is started

Netstat-ant

Tcp 0 0202.207.177.177Viru 11211 0.0.0.0purl * list

Port 11211 has been opened, indicating that memcached has started normally.

4. Restart centos

Reboot

IV. Memcache environment testing

Run the following php file, and if there is an output of this is a testing, it means that the environment has been built successfully. Start your memcache journey!

The famous phpcms also supports memcached extensions:

Thank you for reading, the above is the content of "how to install Memcache under CentOS5.4". After the study of this article, I believe you have a deeper understanding of how to install Memcache under CentOS5.4, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

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

12
Report