memcached installation Configuration
Installation memcached need libevent support, so install libevent first;
First, install the Libevent
1. Download
Cd/usr/local/src
wget https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
2. Installation
# tar ZXVF libevent-2.0.20-stable.tar.gz
# CD Libevent-2.0.20-stable
#./configure--prefix=/usr/local/libevent
# Make && make install
The libevent has been installed and completed;
Second, installation memcached
1. Download
# wget http://memcached.org/files/memcached-1.4.22.tar.gz
Official website: http://memcached.org
2. Installation
# CD/USR/LOCAL/SRC
# tar ZXVF memcached-1.4.22.tar.gz
# CD memcached-1.4.22
#./configure--prefix=/usr/local/memcached
When you do this, you cannot find the path to the libevent, you need to edit configure (vi Configure) to find the trylibeventdir= "" Change to Trylibeventdir= "/usr/local/libevent" To
# Make && make install
3. Start memcached
#/usr/local/memcached/bin/memcached-m 64m-p 11211-d-u root-p/var/run/memcached.pid-c 256
*-m maximum memory size, default is 64m;
*-P uses TCP/IP port, default is 11211;
*-D Run as daemon in the background;
*-U Specify user to start memcached program;
*-P setting saves the location of the memcached PID file;
*-L listens for server IP, if there are multiple addresses;
*-C Maximum number of concurrent connections, the default is 1024, to be based on the server's load amount to set;
4. Close Memcached1
# Kill ' cat/var/run/memcached '
5. View the status of memcached information
#telnet IP (memcached server IP) 11211
Input: Stats can view the relevant information of memcached;
Third, install the memcached PHP extension
1. Download
# wget Http://pecl.php.net/get/memcache-3.0.5.tgz
# tar ZXVF memcache-3.0.5.tgz
# CD memcache-3.0.5
#/usr/local/php/bin/phpize//Generate Configure File
Execute this command as follows:
Configuring for: PHP Api version:20121113 Zend Module Api no:20121212 Zend Extension Api no:220121212 Cannot find autoconf. Please check your autoconf installation and the $PHP _autoconf environment variable. Then, rerun the this script. |
This information prompts you to install autoconf,
# yum Install-y autoconf
Execute this command again:/usr/local/php/bin/phpize as shown below:
Configuring for: PHP Api version:20121113 Zend Module Api no:20121212 Zend Extension Api no:220121212 |
2. Installation
#./configure--enable-memcache--with-php-config=/usr/local/php/bin/php-config
# Make && make install
After this step, you will see the following prompt:
Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/ |
Modify the php.ini file
# Vim/etc/php.ini
to find; extension_dir = "./" modified to Extension_dir = "/usr/local/php/lib/php/extensions/ no-debug-non-zts-20121212/"
Then add the following line of code to the php.ini: extension=memcache.so
Exit save.
The installation configuration is complete at this point;
memcached installation Configuration