Home >Backend Development >PHP Tutorial >PHP installation memcached extension notes, phpmemcached extension_PHP tutorial
Recently, I have been working on the upper cache system of the server, and recorded the installation of memcached extension on PHP.
Copy code 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
Copy code 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 for php in PECL (The PHP Extension Community Library).
Copy code 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 Purple Star!
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
Copy code 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
# Note the final output
# Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Let’s move it to the extension directory of php
Copy code 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
Copy code The code is as follows:
vim /usr/local/php/etc/php.ini
# Add the following configuration
[Memcached]
extension=memcached.so