This article mainly introduces notes on PHP installation of memcached extension. This article explains the installation of server, launchpad, installation of memcached extension and configuration of PHP.ini, etc. Content, friends in need can refer to it
Recently, in the caching system on the upper part of the server, I recorded the installation of memcached extension for PHP.
The code is as follows:
# Install server
yum install memcached -y
I. launchpad
Please download the latest version of libmemcached (20150524) at https://launchpad.net/libmemcached/ download
The code is as follows:
cd /tmp
wget https://launchpad.net/libmemcached/1.0/1.0.18/ download/libmemcached-1.0.18.tar.gz
tar zxf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make
make install
II. Install memcached extension
Find and install the memcached extension of php in PECL (The PHP Extension Community Library).
The code is as follows:
In PECL you can find the following two confusing memcache PHP extensions. Can you tell the difference between them? Do you know why we use the former? Readers please Google it!
memcached PHP extension for interfacing with memcached via libmemcached library
memcache memcached extension
[https://pecl.php.net/package/memcached][4] The latest version is 2.2.0
The code is as follows:
mkdir /usr/src/php -p
cd /usr/src/php
wget https://pecl.php.net/get/memcached -O memcached-2.2.0.tgz
tar xf memcached-2.2.0.tgz
cd memcached-2.2.0
phpize
# We have added some new features to the configuration to support json and igbinary. You can study it when you have time
./configure --enable-memcached --enable-memcached-json --enable-memcached-igbinary
make
make install
# Pay attention to the final output
# Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Next we will move it to the extension directory of php
The code is as follows:
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/*.so /usr/local/php/lib/php/extensions/
III. Configure PHP.ini
Open the valid php.ini file
The code is as follows:
vim /usr/local/php/etc/php.ini
# Add the following configuration
[Memcached]
extension=memcached.so