不言不语

您现在的位置是: 首页 >  PHP

PHP

Linux下PHP安装Memcache扩展

2022-06-05PHP
Memcache是一个高效的NoSQL数据库,PHP和Memcache的搭配使用,可以很好的应对更高负载的场景,可以大大降低MySQL数据库的压力。Memcache扩展的安装和Redis的安装大致一样。PHP的扩展都非常简单。

1、在下载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

文章评论