Install memcache and memcached_PHP

Source: Internet
Author: User
Tags vps
Install memcache and memcached. In short, memcache is the name of the total cache system project, which is easy to be confused with memcache in the php Tutorial. We often mention that memcache is actually a memcache in php, that is, php's memcached extension support. Simply put

Memcache is the name of the total cache system project, which is easy to be confused with memcache in the php Tutorial.

We often mention that memcache is actually a memcache in php, that is, php's memcached extension support.

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

To make your program fly, you must install the memcached server program and the memcached extension of php. if you want to use memcache for the cache system, both memcache and memcached must 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 uses the directory/usr/local/php where php is located as an example. if your php has changed, replace the/usr/local/php section in the following sentence.

#/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 extension

# Vi/etc/php. ini (/etc/php. the ini address is my php. ini location, if you do not know your php. where is the ini? # find/-name php. ini, or pass a probe phpinfo to find the configuration file (php. ini) path) in php. ini location.

Add at the end

Press I on the disk to start editing.

Ctrl + f pull the page to the bottom and add it before [zend]

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

Press esc and then enter

: Wq

Save and exit

Restart your web server, such as apache

/Etc/init. d/httpd restart

Next, refresh the php probe and check if there is any such probe. If yes, it is installed.

Memcache
Version 2.2.5memcache
Version 2.2.5

Install memcached

To install memcached, install libevent first.

If centos is used, yum can be installed.

# Yum install libevent-devel

If the yum system is not supported, you can install libevent like this.

# 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

Install 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 the installation, start memcached and allocate 32 MB of memory (32 indicates the number of memory used, which can be modified as needed)

/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 disk to start editing.

Add at last

/Usr/local/memcached/bin/memcached-d-m 32-l 127.0.0.1-p 11211-u root

Press esc and then enter

: Wq

Save and exit

If needed, you can reboot it, but it should have taken effect without reboot ~

Acceleration effect test

Use discuz x1 with no load for a test. if it is not started

Gmt + 8, processed in 0.038893 second (s), 2 queries.

The effect after the cache is enabled, but the overall effect is not as good as that after the vps tutorial is added to the eaccelerato cache.

Gmt + 8, processed in 0.008383 second (s), 2 queries, memcache on.

Complete

Install memcached

To install memcached, install libevent first.

If centos is used, yum can be installed.

# Yum install libevent-devel

If the yum system is not supported, you can install libevent like this.

# 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

Install 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 the installation, start memcached and allocate 32 MB of memory (32 indicates the number of memory used, which can be modified as needed)

/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 disk to start editing.

Add at last

/Usr/local/memcached/bin/memcached-d-m 32-l 127.0.0.1-p 11211-u root

Press esc and then enter

: Wq

Save and exit

If needed, you can reboot it, but it should have taken effect without reboot ~

Acceleration effect test

Use discuz x1 with no load for a test. if it is not started

Gmt + 8, processed in 0.038893 second (s), 2 queries.

The effect after the cache is enabled, but the vps is not as effective as adding eaccelerato to the cache.

Gmt + 8, processed in 0.008383 second (s), 2 queries, memcache on.

Complete


Memcache is the name of the total cache system project, which is easy to be confused with memcache in the php Tutorial. We often mention that memcache is actually a memcache in php, that is, php's memcached extension support ....

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.