CentOS Installation Memcache

Source: Internet
Author: User
Tags memcached

1. Install libevent before installing Memcached , first download with wget Libevent:

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


2. installation 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:

q -P uses the TCP Port. Default is 211

q - m maximum memory size. Default is 64MB

q -vv starting in very vrebose mode, debugging information and error output to the console

q - D runs in the background as a daemon

Q -c Maximum number of concurrent connections, the default is 1024x768, according to the server load amount to set

q -P settings save Memcache pid file

q - l listens for the server IP address, if there are multiple addresses

q -u user running Memcached , default cannot be started by root user, so the current user is root User, you need to use the - u parameter to specify.

There are many other options, through the /usr/local/bin/memcached–h command to display all available options.


4. Test if the connection is normal

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8D/08/wKioL1iDMGWAtsg0AAApc6IHTB8838.png-wh_500x0-wm_3 -wmp_4-s_2590118411.png "title=" Image.png "alt=" Wkiol1idmgwatsg0aaapc6ihtb8838.png-wh_50 "/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

5. Install Memcache PHP Extended

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 php.ini file, put php.ini in the Extension_dir = "./"

modified to Extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-zts-20060613/"

Add the following line of code to load the Memcache Extensions:

Extension=memcache.so

Restart php



6. test Memcache 's PHP whether the extension was successfully installed


Run the following PHP code if the output Hello world! , it means the environment is built successfully.

< PHP

$mem = new Memcache;

$mem->connect (' 127.0.0.1 ', 11211);

$mem->set (' Test ', ' Hello world! ', 0, 12);

$val = $mem->get (' Test ');

Echo $val;

?>


This article is from the "IT" blog, so be sure to keep this source http://wang3781.blog.51cto.com/9428009/1893575

CentOS Installation Memcache

Related Article

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.