Installing Memcache and memcached_php Tutorials

Source: Internet
Author: User
Tags php memcached vps
To put it simply

Memcache is the total cache system project name and is easy to confuse with Memcache in PHP tutorials.

We often mention that memcache is actually PHP's memcache, which is PHP's memcached extension support.

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 and PHP memcached extensions, so if you want to use Memcache to cache the system, both memcache and memcached need to be installed.

Installing 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

In the following sentence, the PHP directory is/usr/local/php for example, if your PHP changes, please replace some of the/usr/local/php part of the sentence

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

Adding memcache to the PHP extension

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

Join at the end

Press I on the keyboard to start editing

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

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 to refresh the PHP probe, to see if there is this, there is the right to install

Memcache
Version 2.2.5memcache
Version 2.2.5

Install memcached below

Installing memcached first requires installation and installation Libevent

If it is CentOS you can install Yum

# yum Install Libevent-devel

If the Yum system is not supported, this can be installed 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 of memory (32 to use 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

Adding memcached to the startup item

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

Press I on the keyboard to start editing

At the end of the 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 necessary, can reboot, but not reboot should have been effective ~

Accelerated Effect Testing

Do a test with discuz x1 with no load, when not enabled

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

The effect of the cache is enabled, but the overall feeling of the VPS tutorial is not as effective as using the Eaccelerato cache join effect so obvious

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

Complete

Install memcached below

Installing memcached first requires installation and installation Libevent

If it is CentOS you can install Yum

# yum Install Libevent-devel

If the Yum system is not supported, this can be installed 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 of memory (32 to use 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

Adding memcached to the startup item

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

Press I on the keyboard to start editing

At the end of the 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 necessary, can reboot, but not reboot should have been effective ~

Accelerated Effect Testing

Do a test with discuz x1 with no load, when not enabled

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

The effect of the cache is enabled, but the overall feeling of the VPS on the effect is not as obvious as Eaccelerato cache join effect

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

Complete


http://www.bkjia.com/PHPjc/444801.html www.bkjia.com true http://www.bkjia.com/PHPjc/444801.html techarticle Simply put, Memcache is the total cache system project name, which is easy to confuse with Memcache in PHP tutorials. We often mention that memcache is actually PHP's memcache, which 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.