怎样编译安装PHP的memcache扩展

2021年4月2日 | 分类: 【技术】

【介绍】

官网:http://pecl.php.net/package/memcache

【安装:源码编译yum方式】

wget http://pecl.php.net/get/memcache-2.2.7.tgz && tar zxvf memcache-2.2.7.tgz && cd memcache-2.2.7
phpize
./configure --with-php-config=/opt/remi/php56/root/usr/bin/php-config --enable-memcache
make && make install

输出:

Installing shared extensions:     /opt/remi/php56/root/usr/lib64/php/modules/

编辑:/etc/opt/remi/php56/php.ini

[memcache]
extension = "memcache.so"

【安装:yum方式】

yum install php-pecl-memcache -y

路径:/usr/lib64/php/modules/memcache.so

【排错】

报错:PHP message: PHP Fatal error: Uncaught Error: Class ‘Memcache’ not found

参考:http://cncc.bingj.com/cache.aspx?q=Uncaught+Error%3a+Class+%27Memcache%27+not+found+in+&d=4624400069306796&mkt=zh-CN&setlang=zh-CN&w=HcoOJzvd7v0272DhA2oGW00HP_AC94sV
参考:https://stackoverflow.com/questions/2659035/php-memcached-fatal-error-class-memcache-not-found

It looks like you’re trying to use one (“memcache”), but the other is installed (“memcached”).

去 /usr/lib64/php/modules/ 删除 memcached.so