PHP extensions memcache and memcached installation

Source: Internet
Author: User
Tags php memcached phpinfo zts

First, the difference between Memcache and memcached is briefly introduced.

Two different versions of PHP's memcached client
New Memcache is the PECL extension library version
New memcached is the libmemcached version

Memcache was first developed in February 2004 and last updated in April 2013, while Memcached was originally developed in January 2009, and the last update was updated in January 2014. So Memcache's history is earlier than memcached.

Installing the memcache extension does not require the installation of other things, but in the installation of memcached will require you to install libmemcached, the problem, libmemcached is the C client of Memcache, it has the advantage of low memory, Line Cheng and other characteristics.


Installing PHP's memcached extension

1. Download file:
    https:// launchpad.net/libmemcached/+download, download libmemcached dependent library
    http://pecl.php.net/package/memcached, download php memcached extension
2. Unzip
    tar zxvf libmemcached-0.44.tar.gz
    tar ZXVF memcached-1.0.2.tgz
3. Compiling libmemcached
    CD libmemcached-0.44
   ./configure--prefix=/usr/local/libmemcached
    make && make install

4. Compiling memcached extensions
CD memcached-1.0.2
/usr/local/php/bin/php/phpize
./configure -with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/ local/libmemcached --enable-memcached #与安装libmemcached时指定的prefix一致

Make && Make Install

    # Add a line: EXTERSION=MEMCACHED.SO
6. Restart PHP Service
7. Validation (view phpinfo)

memcached
memcached support    enabled
version     1.0.2
libmemcached version     0.44
session support     Yes
igbinary support     no

# # #如果在添加扩展so文件时, modify php.ini directly, then the following error may occur:
/usr/lib/php/modules/memcached.so:undefined Symbol:php_json_encode in Unknown on line 0
This error occurs because json.so must be loaded before the memcached.so is loaded, and json.so is loaded in/etc/php.d/json.ini, which causes json.so to load after memcached.so and can delete/etc/ Php.d/json.ini file, and add extensino=json.so directly in php.ini to resolve (add before memcached.so)


Installing PHP's Memcache extension
1. Select the Memcache version you want to download in the Http://pecl.php.net/package/memcache.
2. Installing the PHP memcache extension

Tar zxf memcache-3.0.6.tgz

CD memcache-3.0.6

/usr/local/php/bin/phpize

./configure--enable-memcache=/usr/local/memcache--with-php-config=/usr/local/php/bin/php-config

Make && make install

3. There will be a hint like this after the installation is complete:

Installing Shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/

4. Change the Extension_dir in php.ini = "./" To

Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/"

Add a row to load the memcache extension: extension=memcache.so

5. Restart Apache,service httpd restart

Test, view with Phpinfo



This article is from the "Xiang Dao Empty" blog, please be sure to keep this source http://xuta0.blog.51cto.com/3405932/1598912

PHP extensions memcache and memcached installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.