CentOS Environment PHP installation memcache extension

Source: Internet
Author: User

Installing Memcache

Yum Install memcached  

Installing the Libmemcached Library

Yum Install libmemcached

PHP Installation Memcache Extensions

[Email protected]] Wget-c http://pecl.php.net/get/memcache-3.0.8. Tgz[root@blog. phpha.com] TAR-ZXVF memcache-3.0.8. Tgz[root@blog. phpha.com] CD memcache-3.0.8[Root@blog. phpha.com]/usr/local/php/bin/Phpize[root@blog. phpha.com]./configure-with-php-config=/usr/bin/php-config-with-zlib-Dir[root@blog. phpha.com] Make &&Make Install#Installing shared extensions:/usr/lib64/php/modules/#/usr/lib64/php/modules/memcache.so[[email protected]] vim/etc/php.ini#Extension =/usr/lib64/php/modules/memcache.so[[email protected]] service PHP-FPM Reload

Start

memcached-d-U root-p 11211

Test:

<?PHP$mem=NewMemcache;$mem->addserver ("localhost", 11211);Echo"Version:".$mem-getversion ();classtestclass{Private $str _attr; Private $int _attr;  Public function__construct ($str,$int)        {                $this->str_attr =$str; $this->int_attr =$int; }         Public functionSET_STR ($str)        {                $this->str_attr =$str; }         Public functionSet_int ($int)        {                $this->int_attr =$int; }         Public functionGet_str () {return $this-str_attr; }         Public functionGet_int () {return $this-int_attr; }}$test=NewTestClass ("Hell World", 1123);$mem->set ("Key",$test,false, 1000);Var_dump($mem->get ("Key"));$test _array=Array("index_1" = "Hello", "Index_2" and "World");$mem->set ("Array_test",$test _array,false);Var_dump($mem->get ("Array_test"));?>
View Code

Problem:

1. Php-config not Found

Find/-name Php-config

2. ZLIB memcache support requires ZLIB not found

Yum Install Zlib-devel

3.can ' t run as root without the-u switch

Memecached-u Root Start

Reference:

CentOS installs memcache.http://blog.csdn.net/php_boy/article/details/6880488 for PHP

CentOS Environment PHP installation memcache extension. http://blog.phpha.com/archives/1554.html

CentOS Installation memcache.http://www.cnblogs.com/wubaiqing/archive/2011/09/19/2181602.html

CentOS Environment PHP installation memcache extension

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.