网上大部分是使用phpize编译共享PECL扩展库,但是我这有台机器用这方法怎么也加载不了memcache,于是换另一种方法将PECL扩展库静态编译入PHP,
# tar xvf memcache-3.0.6.tgz
# cd /usr/local/software/php-5.3.8/ext
# mv /usr/local/src/memcache-3.0.6 ./memcache
删除或是修改老的configure名字
# cd /usr/local/software/php-5.3.8
# mv configure configure.bak
# ./buildconf --force
# ./configure --help(从这就可以看到上面显示有memcache参数)
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-curl --with-curlwrappers --with-mhash --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear --enable-zip --enable-soap --enable-mbstring --enable-ftp --enable-sockets --enable-pcntl --enable-bcmath --enable-shmop --enable-sysvsem --enable-memcache --enable-inline-optimization --enable-mbregex --with-apxs2=/usr/local/apache2/bin/apxs
(注:编译发现configure的时候加上--disable-rpath就会报:
char *... configure: error: cannot compute sizeof (char *), 77
去掉这个参数就能正常通过,但是并不是所有的机器上都出这个错误;看来还是和环境有关系。
看了下文档;这个参数貌似是运行时不去某些路径搜索动态库。)
# make && make instal
Note: 要运行“buildconf”脚本,需要 autoconf 2.13 和 automake 1.4+(更新版本的 autoconf 也许能工作,但不被支持)。
打开phpinfo页面查看,