Linux configuration Installation memcached 2 ways to install memcache at the same time for PHP

Source: Internet
Author: User
Tags install php memcached pack php memcached zts zend

Method One

Environment: CentOS 6.2 32-bit system, PHP 5.4.25 (upgraded from 5.2.17 to 5.4.25), memcached 1.4.15

Expansion pack Download path: Http://pecl.php.net/package/memcache
The 3.0.6 memcache expansion pack is just starting to be installed, and the extended installation path is

The code is as follows Copy Code

/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so

Extensions are also configured in PHP.ini, configured as follows:

The code is as follows Copy Code

[Memcache]
Extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so

After restarting the service, Memcache is still unable to use the following error:

PHP warning:php Startup:memcache:Unable to initialize module
Module compiled with module api=20060613
PHP compiled with module api=20100525

Guess with the expansion pack version is not about, find a stable version of the memcache-2.2.7 package, install everything smooth, PHP can connect memcache to operate.
What is the cause of the above error?

View Phpize-v and display the following information:

The code is as follows Copy Code

Configuring for:
PHP Api version:20100412
Zend Module Api no:20100525
Zend Extension Api no:220100525
PHP API version and Zend Module API No

Why is it inconsistent? The PHP version causes the

Add: Using Yum installation method

1. Installation via Yum

The code is as follows Copy Code
Yum-y Install memcached
#安装完成后执行:
Memcached-h

#出现memcached帮助信息说明安装成功


2. Join Start Service

The code is as follows Copy Code

Chkconfig--level 2345 memcached on


3. Configure memcached

The code is as follows Copy Code

Vim/etc/sysconfig/memcached
#文件中内容如下, modify as needed:
Port= "11211" #端口
user= "Root" #用户名
maxconn= "1024" #最大连接数
The "cachesize=" #内存大小
Options= "" #附加参数


4. Install libmemached

The code is as follows Copy Code

wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
TAR-ZXVF libmemcached-1.0.16.tar.gz
CD libmemcached-1.0.16
./configure-prefix=/usr/local/libmemcached-with-memcached
Make && make install


5. Install Php-devel

The code is as follows Copy Code
Yum Install Php-devel


6. Install php memcached Extension

  code is as follows copy code

wget http:/ /pecl.php.net/get/memcached-2.1.0.tgz
TAR-ZXVF memcached-2.1.0.tgz
CD memcached-2.1.0
/usr/local/php/ Bin/phpize
./configure-enable-memcached-with-php-config=/usr/local/php/bin/php-config-with-zlib-dir- With-libmemcached-dir=/usr/local/libmemcached-prefix=/usr/local/phpmemcached
Make && make install

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.