Installing memcached on Linux is not too difficult. The only thing that makes me feel difficult is Php7 's memcache extension installation. It's really a pain in the egg!
First, install the server memcached
1. First install the Libevent event trigger manager.
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar vxf libevent-2.0. -stable. Tar . GZCD libevent-2.0. -stable. /configure-prefix=/usr/local/libevent #./Configuremake doinstall
2. Compile and install memcached
wget http://memcached.org/latestcp latest memcached. Tar . GZ tar -zxvf memcached. Tar . GZCD memcached. /configure-with-libevent=/usr/local/libevent #./Configure make make Install
3. Start memcached
- 127.0. 0.1 11211 -u root # (128 for memory, 11211 for port, root for user group)
4. After power on/reboot, edit the/etc/rc.d/rc.local file, add the following content.
- 127.0. 0.1 11211 -U root
5. See if the startup is successful
PS Aux|grep memcached
is successful
-----------------------------------------------------------------------Split Line----------------------------------------------- ------------------------------------
The following is an extension of PHP memcache installed.
Using the previous version of PHP installation is no problem, but with the PHP7 installation Http://pecl.php.net/package/memcache under any of the memcache will be error
After exhausting everything, I found the Pecl-memcache branch version of GitHub .
This underground load, HTTPS://github. COM/websupport-sk/pecl-memcache/archive/php7. zip
1. The RZ command is uploaded to the Linux virtual machine.
Unzip PECL-MEMCACHE-PHP7. Zip CD pecl-memcache-php7/usr/local/php/bin/phpize. /configure--with-php-config=/usr/local/php/bin/php-configmake doinstall
2. Modify the php.ini load Memcache component
" /usr/local/php70/lib/php/extensions/no-debug-non-zts-20151012/ " "memcache.so"
Note!!! Be sure to confirm the location of the valid php.ini
Ways to find php.ini locations
1. Write a test file, Content <?php phpinfo ();, in the 78th row or so, there is "Loaded Configuration file" that indicates the location of the php.ini.
2. PHP.ini is not specified or php.ini (none) is not found, PHP will run according to the default configuration.
3. Restart PHP-FPM
kill -USR2 'cat /var/run/php-fpm.pid '
Install PHP7 memcache extensions and install server memcached on Linux