Linux下PHP安装Memcache扩展
Memcache是一个高效的NoSQL数据库,PHP和Memcache的搭配使用,可以很好的应对更高负载的场景,可以大大降低MySQL数据库的压力。Memcache扩展的安装和Redis的安装大致一样。PHP的扩展都非常简单。
1、在PECL下载PHP Memcache扩展
1 | [root@web ~]# wget http://pecl.php.net/get/memcache-2.2.7.tgz |
2、解压安装并进入Memcache目录
1 2 | [root@web ~]# tar xzf memcache-2.2.7.tgz [root@web ~]# cd memcache-2.2.7 |
3、在Memcache目录下,生成configure配置文件
1 2 3 4 5 6 7 8 9 10 | [root@web memcache-2.2.7]# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 [root@web memcache-2.2.7]# ./configure –with-php-config=/usr/local/php/bin/php-config [root@web memcache-2.2.7]# make 注意:一定要用root用户。 [root@web memcache-2.2.7]# make install |
4、在PHP配置文件php.ini里面加载Memcache扩展
1 | extension=memcache.so |
5、查看phpinfo,Memcache扩展是否加载
memcache
memcache Support enabled
Version 2.2.7
2016年10月19日 上午11:26
phpize 这步直接出错
Cannot find config.m4.
Make sure that you run ‘/usr/local/service/php/bin/phpize’ in the top level source directory of the module
2019年5月9日 下午7:28
好文!转载了。
2019年5月10日 下午4:33
写的太经典了,我竟无言以对。