[root@localhost src]# wget http://pecl.php.net/get/memcache-2.2.7.tgz
[root@localhost src]# tar zxvf memcache-2.2.7.tgz
[root@localhost src]# cd memcache-2.2.7
php56安装memcache扩展
[root@localhost memcache-2.2.7]# /usr/local/php56/bin/phpize
准备./configure的时候 没有生成出来configure
[root@localhost memcache-2.2.7]# yum -y install autoconf
再执行phpize 然后有configure了
[root@localhost memcache-2.2.7]# ./configure --with-php-config=/usr/local/php56/bin/php-config --enable-memcache
make && make install
vim /usr/local/php56/lib/php.ini
加上一行
extension = "memcache.so"
重启php 、Nginx
然后就ok了
如果没有还没有加载上memcache扩展 可能是修改的php.ini不是加载的那个
/usr/local/php56/bin/php --ini
或者strace -o php.log -s 65535 /usr/local/php56/bin/php -i|grep .ini或者写个test.php查看下PHPinfo或者/usr/local/php56/bin/php -i|grep php.ini等方式
如果看到调用的是Configuration File (php.ini) Path => /usr/local/php56/lib
默认的
而那个目录下没有php.ini 可以拷贝一个到/usr/local/php56/lib下 然后重启
如果重启php的时候出现:memcache.so: undefined symbol: executor_globals in Unknown on line 0
原因是之前用其它版本的phpize过
使用 /usr/local/php56zts/bin/phpize --clean一下 再phpize即可
或者重新解压一份
php72安装memcache扩展
[root@localhost memcache-2.2.7]# /usr/local/php72/bin/phpize
[root@localhost memcache-2.2.7]# ./configure --with-php-config=/usr/local/php72/bin/php-config
......
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
[root@localhost memcache-2.2.7]# make && make install
/bin/sh /usr/local/src/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php72/include/php -I. -I/usr/local/src/memcache-2.2.7 -DPHP_ATOM_INC -I/usr/local/src/memcache-2.2.7/include -I/usr/local/src/memcache-2.2.7/main -I/usr/local/src/memcache-2.2.7 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/memcache-2.2.7/memcache.c -o memcache.lo
mkdir .libs
cc -I/usr/local/php72/include/php -I. -I/usr/local/src/memcache-2.2.7 -DPHP_ATOM_INC -I/usr/local/src/memcache-2.2.7/include -I/usr/local/src/memcache-2.2.7/main -I/usr/local/src/memcache-2.2.7 -I/usr/local/php72/include/php -I/usr/local/php72/include/php/main -I/usr/local/php72/include/php/TSRM -I/usr/local/php72/include/php/Zend -I/usr/local/php72/include/php/ext -I/usr/local/php72/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/memcache-2.2.7/memcache.c -fPIC -DPIC -o .libs/memcache.o
/usr/local/src/memcache-2.2.7/memcache.c:40:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
#include "ext/standard/php_smart_str.h"
^
compilation terminated.
make: *** [memcache.lo] Error 1
蛋疼的问题出现了
这个问题并没有很好的解决掉