美文网首页
centos下安装PHP的memcache扩展

centos下安装PHP的memcache扩展

作者: 菩提老鹰 | 来源:发表于2015-12-29 19:58 被阅读0次

Title: 2015-12-29-install-phpmemcache
Date: 2015-12-29
Author: ColinLiu
Category: Memcache
tags: php,memcache

Requirments

yum install zlib
yum install libevent

Installation

root@pts/2 $ yum install php-pecl-memcache
Loaded plugins: fastestmirror
Zabbix                                      |  951 B  00:00:00     
base                                        | 3.6 kB  00:00:00     
epel/x86_64/metalink                        | 3.6 kB  00:00:00     
epel                                        | 4.3 kB  00:00:00     
extras                                      | 3.4 kB  00:00:00     
mongodb                                     |  951 B  00:00:00     
nginx                                       | 2.9 kB  00:00:00     
remi-safe                                   | 2.9 kB  00:00:00     
rundeck-release-bintray                     | 1.3 kB  00:00:00     
updates                                     | 3.4 kB  00:00:00     
remi-safe/primary_db                        | 328 kB  00:00:25     
Determining fastest mirrors
 * base: mirrors.yun-idc.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * remi-safe: mirror5.layerjet.com
 * updates: mirrors.yun-idc.com
Resolving Dependencies
--> Running transaction check
---> Package php-pecl-memcache.x86_64 0:3.0.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                              Arch                                      Version                                        Repository                               Size
=============================================================================================================================================================================================
Installing:
 php-pecl-memcache                                    x86_64                                    3.0.8-4.el7                                    base                                     67 k

Transaction Summary
=============================================================================================================================================================================================
Install  1 Package

Total download size: 67 k
Installed size: 171 k
Is this ok [y/d/N]: y
Downloading packages:
php-pecl-memcache-3.0.8-4.el7.x86_64.rpm                                                                                                                              |  67 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : php-pecl-memcache-3.0.8-4.el7.x86_64                                                                                                                                      1/1 
  Verifying  : php-pecl-memcache-3.0.8-4.el7.x86_64                                                                                                                                      1/1 

Installed:
  php-pecl-memcache.x86_64 0:3.0.8-4.el7                                                                                                                                                     

Complete!
zabbix-server [~] 2015-12-29 15:27:36


## After install you can execuate `updatedb` and then locate memcache.so if exist
root@pts/2 $ updatedb
zabbix-server [~] 2015-12-29 15:27:43
root@pts/2 $ locate memcache.so
/usr/lib64/httpd/modules/mod_socache_memcache.so
/usr/lib64/php/modules/memcache.so


## edit configure and add memcache.so in /etc/php.d/memcache.ini
root@pts/2 $ vim /etc/php.d/memcache.ini 
zabbix-server [~] 2015-12-29 15:28:09
root@pts/2 $ head -2 /etc/php.d/memcache.ini 
; ----- Enable memcache extension module
extension=memcache.so
zabbix-server [~] 2015-12-29 15:28:22


## To take effect, kill and start
root@pts/2 $ ps -ef|grep php-fpm
apache    1334 12167  0 Dec28 ?        00:01:55 php-fpm: pool www
root      8408 16150  0 15:28 pts/2    00:00:00 grep --color=auto php-fpm
root     12167     1  0 Dec28 ?        00:00:05 php-fpm: master process (/etc/php-fpm.conf)
apache   12168 12167  0 Dec28 ?        00:02:03 php-fpm: pool www
apache   12169 12167  0 Dec28 ?        00:02:05 php-fpm: pool www
apache   12170 12167  0 Dec28 ?        00:02:14 php-fpm: pool www
apache   12171 12167  0 Dec28 ?        00:02:12 php-fpm: pool www
apache   12172 12167  0 Dec28 ?        00:02:06 php-fpm: pool www
apache   12178 12167  0 Dec28 ?        00:02:09 php-fpm: pool www
apache   13582 12167  0 Dec28 ?        00:02:04 php-fpm: pool www
zabbix-server [~] 2015-12-29 15:28:40
root@pts/2 $ kill 12167
zabbix-server [~] 2015-12-29 15:28:43
root@pts/2 $ ps -ef|grep php-fpm
root      8456 16150  0 15:28 pts/2    00:00:00 grep --color=auto php-fpm
zabbix-server [~] 2015-12-29 15:28:45
root@pts/2 $ php-fpm
zabbix-server [~] 2015-12-29 15:28:49
root@pts/2 $ ps -ef|grep php-fpm
root      8499     1  0 15:28 ?        00:00:00 php-fpm: master process (/etc/php-fpm.conf)
apache    8500  8499  0 15:28 ?        00:00:00 php-fpm: pool www
apache    8501  8499  0 15:28 ?        00:00:00 php-fpm: pool www
apache    8502  8499  7 15:28 ?        00:00:00 php-fpm: pool www
apache    8503  8499  0 15:28 ?        00:00:00 php-fpm: pool www
apache    8504  8499  0 15:28 ?        00:00:00 php-fpm: pool www
root      8528 16150  0 15:28 pts/2    00:00:00 grep --color=auto php-fpm

Additional

memcache VS memcached

memcache document
http://pecl.php.net/package/memcache

memcache function list
http://cn2.php.net/memcache

memcached document
http://pecl.php.net/package/memcached

memcache function list
http://www.php.net/manual/zh/book.memcached.php

Refer to

http://www.cnblogs.com/yjf512/p/3778287.html

http://www.ttlsa.com/memcache/memcache-and-memcached-php-php-and-problems/

相关文章

网友评论

      本文标题:centos下安装PHP的memcache扩展

      本文链接:https://www.haomeiwen.com/subject/idrihttx.html