Installing memcached under Linux

Time:2020-5-28

Memcached installation steps

1. Set up a good LNMP environment in the computer installation

Memcached installation package
Libmemcached install PHP extension dependency package
PHP memcached PHP extension

2. Install dependency package

yum install -y libevent libevent-devel

3. Install memcached

tar -zxvf memcached-1.4.33.tar.gz
cd memcached-1.4.33
./configure --prefix=/usr/local/memcached
make && make install

4. Open service

cd /usr/local/memcached/bin
./memcached -u www -d
-U specified user, cannot start as root user
-D background operation
See if the service is running
ps -ef | grep memcached
Netstat - LNP | grep memcached port number is 11211 by default

5. Install PHP extension library

Install libmemcached first
    tar -zxvf libmemcached-1.0.18.tar.gz
    cd libmemcached-1.0.18
    ./configure --prefix=/usr/local/libmemcached --with-memcached=/usr/local/memcached/
    make && make install
Install PHP extension library
    yum install -y unzip
    unzip php-memcached-php7.zip
    cd php-memcached-php7
Compiling PHP extension library with phpize
    ls /usr/local/php7/bin
    /usr/local/php7/bin/phpize
    ./configure --with-php-config=/usr/local/php7/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/
    make && make install
    
    Path to expansion package
    /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so
    [note] the extension library under windows is. DLL, and the extension library under Linux is. So
    
Add the extension library to the PHP configuration file
vi /etc/php.ini
Add on line 900
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so

Restart PHP FPM
service php-fpm restart

Run phpinfo to check whether there is an extension library

Recommended Today

The way of nonlinear optimization

Mathematical knowledge 1、 Nonlinear functionLinear function is another name of a function of first degree, then nonlinear function means that the function image is not a function of a straight line.Nonlinear functions include exponential function, power function, logarithmic function, polynomial function and so on. 2、 Taylor expansion1. Taylor formula:Taylor’s formula is to add a_ The […]