Source code era PHP practical information sharing | Linux system installation memcached, rookie counterattack essential tutorial!
Linux system installs memcached
1. First, install the libeventlibrary.
Yum install libevent libevent-devel
two。 Source code installation memcached
Wget online download tool
Yum install-y wget# download source code online
Wget http://memcached.org/files/memcached-1.5.16.tar.gz
Tar xf memcached-1.5.16.tar.gz
Cd memcached-1.5.16, # configuration
. / configure-- prefix=/usr/local/lamp/memcached
Make
Make install
Run memcached
/ usr/local/lamp/memcached/bin/memcached-d-m 64m-u root-p 11211-c 256
4. Check to see if memcached is running
Ps aux | grep memcached
Use PHP code to manipulate memcached download and install libmemcached
Cd / root/software
Wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
Tar xf libmemcached-1.0.18.tar.gz
Cd libmemcached-1.0.18
. / configure-prefix=/usr/local/libmemcached-with-memcached
Make
Make install
two。 Install the memcached extension
Cd / root/software
Wget https://pecl.php.net/get/memcached-3.1.3.tgz
Tar xf memcached-3.1.3.tgz
Cd memcached-3.1.3
/ usr/local/lamp/php/bin/phpize
. / configure-- with-php-config=/usr/local/lamp/php/bin/php-config\
-with-libmemcached-dir=/usr/local/libmemcached-disable-memcached-sasl
Make
Make install
3. Modify php.ini to add memcached extension
Echo "extension=memcached.so" > > / usr/local/lamp/php/lib/php.ini
4. Restart the apache server
Service httpd restart
5. Write PHP code to manipulate memcached
Check the php manual: https://www.php.net/manual/zh/book.memcached.php