Website Accelerated VPS Memcache and memcached installation method _linux

Source: Internet
Author: User
Tags memcached php memcached phpinfo vps

What is Memcache?

Memcache is a free and open source, high-performance, allocated memory object caching system. Used to speed up dynamic Web applications and reduce database load.

It can handle any number of connections and use non-blocking network IO. Because its working mechanism is to open up a space in memory, and then establish a hashtable,memcached self management of these hashtable.

What's memcached?

Memcached is the main program file of the Memcache system, running on one or more servers in a daemon, accepting the client's connection operation at any time, and accessing the data using shared memory.

What is the memcache in PHP? The Memcache in PHP is one of the PHP support extensions for connecting memecached (available phpinfo view), similar to Mbstring,eaccelerator.

To put it simply,

Memcache is the total cache system project name and is easily confused with memcache in PHP.

We often mention that memcache is actually a memcache in PHP, the memcached extension support for PHP.

We often mention that memcached is the server-side main program file, the server-side installer.

In order for your program to fly, you must install the Memcached server program and the PHP memcached extension, so if you want to use Memcache to cache the system, both memcache and memcached need to be installed.

Install Memcache

# CD/USR/LOCAL/SRC
# wget Http://pecl.php.net/get/memcache-2.2.5.tgz
# gzip-d Memcache-2.2.5.tgz
# tar XVF Memcache-2.2.5.tar
# CD memcache-2.2.5

The following sentence, is the PHP directory for/usr/local/php as an example, if your PHP changes, please replace the/usr/local/php part of a few sentences

#/usr/local/php/bin/phpize
#./configure--enable-memcache--with-php-config=/usr/local/php/bin/php-config--with-zlib-dir
# Make && make install

Add Memcache to PHP extensions

# Vi/etc/php.ini (/etc/php.ini address for my php.ini position, if you don't know where your php.ini is, you can use # Find/-name PHP.ini, or send a probe phpinfo to find the php.ini position in configuration File (php.ini) Path.

Add at end

Press I on the keyboard to start editing

Ctrl+f page to the bottom before [Zend] Join

Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
Extension=memcache.so

Press the ESC key, and then enter

: Wq

Save exit

Restart your Web server, such as Apache

/ETC/INIT.D/HTTPD restart

Below refresh under the PHP probe, see if there is this, if any, is installed

Memcache
Version 2.2.5memcache
Version 2.2.5

Install memcached below

Install memcached first need installation installation Libevent

If it is CentOS can yum install

# yum Install Libevent-devel

If the Yum system is not supported, it can be installed like this libevent

# CD/USR/LOCAL/SRC
# wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
# tar vxf libevent-1.4.12-stable.tar.gz
# CD libevent-1.4.12
#./configure--prefix=/usr/local/libevent
# Make && make install

Continuous installation memcached

# CD/USR/LOCAL/SRC
# wget http://cloud.github.com/downloads/saberma/saberma.github.com/memcached-1.4.4.tar.gz
# tar vxf memcached-1.4.4.tar.gz
# CD memcached-1.4.4
#./configure--prefix=/usr/local/memcached
# Make && make install

After installation, start memcached and allocate 32m memory (32 for the use of memory, can be modified according to their own circumstances)

/usr/local/memcached/bin/memcached-d-M 32-l 127.0.0.1-p 11211-u Root

Add memcached to the startup item

# vi/etc/rc.d/rc.local

Press I on the keyboard to start editing

In the final join

/usr/local/memcached/bin/memcached-d-M 32-l 127.0.0.1-p 11211-u Root

Press the ESC key, and then enter

: Wq

Save exit

If you need, you can reboot, but do not reboot should have been effective ~

Accelerated effect Test

Test with Discuz X1 with no load, not enabled

Gmt+8, 2010-9-12 09:08, processed in 0.038893 second (s), 2 queries.

Cache-enabled effect, but the overall feeling of the VPS on the effect of using the Eaccelerato cache to join the effect so obvious

Gmt+8, 2010-9-12 09:08, processed in 0.008383 second (s), 2 queries, Memcache on.

Complete

Install memcached below

Install memcached first need installation installation Libevent

If it is CentOS can yum install

# yum Install Libevent-devel

If the Yum system is not supported, it can be installed like this libevent

# CD/USR/LOCAL/SRC
# wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
# tar vxf libevent-1.4.12-stable.tar.gz
# CD libevent-1.4.12
#./configure--prefix=/usr/local/libevent
# Make && make install

Continuous installation memcached

# CD/USR/LOCAL/SRC
# wget http://cloud.github.com/downloads/saberma/saberma.github.com/memcached-1.4.4.tar.gz
# tar vxf memcached-1.4.4.tar.gz
# CD memcached-1.4.4
#./configure--prefix=/usr/local/memcached
# Make && make install

After installation, start memcached and allocate 32m memory (32 for the use of memory, can be modified according to their own circumstances)

/usr/local/memcached/bin/memcached-d-M 32-l 127.0.0.1-p 11211-u Root

Add memcached to the startup item

# vi/etc/rc.d/rc.local

Press I on the keyboard to start editing

In the final join

/usr/local/memcached/bin/memcached-d-M 32-l 127.0.0.1-p 11211-u Root

Press the ESC key, and then enter

: Wq

Save exit

If you need, you can reboot, but do not reboot should have been effective ~

Accelerated effect Test

Test with Discuz X1 with no load, not enabled

Gmt+8, 2010-9-12 09:08, processed in 0.038893 second (s), 2 queries.

Cache-enabled effect, but the overall feeling of the VPS on the effect of using the Eaccelerato cache to join the effect so obvious

Gmt+8, 2010-9-12 09:08, processed in 0.008383 second (s), 2 queries, Memcache on.

Complete

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.