php 几个扩展(extension)的安装笔记


centos下安装php扩展时遇到的问题

1.imap

cd /root/php-5.6.27/ext/imap /usr/local/php/bin/phpize ./configure --prefix=/usr/local/imap

错误1

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

解决方法

yum install libc-client-devel -y

错误2

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

解决方法

ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so

错误3

configure: error: This c-client library is built with Kerberos support. Add --with-kerberos to your configure line. Check config.log for details.

解决方法

./configure --prefix=/usr/local/imap --with-kerberos

错误4

configure: error: This c-client library is built with SSL support. Add --with-imap-ssl to your configure line. Check config.log for details.

解决方法

 ./configure --prefix=/usr/local/imap --with-kerberos --with-imap-ssl

make && make install


2.opcache

 

cd /root/php-5.6.27/ext/opcache /usr/local/php/bin/phpize ./configure --prefix=/usr/local/opcache make && make install 
echo "extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so" >> /etc/php.ini service php-fpm restart

错误1

Gracefully shutting down php-fpm . done Starting php-fpm [15-Jan-2018 13:45:26] NOTICE: PHP message: PHP Warning:  PHP Startup: Invalid library (appears to be a Zend Extension, try loading using zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so from php.ini) in Unknown on line 0
 done

解决方法

#把extension改成zend_extension echo "zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.so" >> /etc/php.ini

3.apcu
默认没有apcu的扩展包,需要额外下载
github地址
php 5.6版本,下载4.0.11版本的apcu
然后是正常安装

4.gd
首先安装:jpegsrc,freetype,libpng
tar xf jpegsrc.v9.tar.gz cd jpeg-9/ CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/jpeg make && make install
tar zxf freetype-2.7.1.tar.gz cd freetype-2.7.1 ./configure --prefix=/usr/local/freetype make && make install
tar zxf libpng-1.6.29.tar.gz cd libpng-1.6.29 CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/libpng make && make install

然后编译gd库

cd /root/php-5.6.27/ext/gd/
/usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype make && make install
复制最后显示的一行 /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
在/etc/php.ini最后一行添加
echo "extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/gd.so" >> /etc/php.ini

 


5.ldap
php-ldap模块作用就是实现ldap认证,因此需要安装openldap openldap-devel
yum install openldap yum install openldap-devel
拷贝库文件
cp -frp /usr/lib64/libldap* /usr/lib/
编译安装php-ldap模块
cd /usr/local/src/php-7.0.21/ext/ldap/  
/usr/local/php/bin/phpize          ./configure --with-php-config=/usr/local/php/bin/php-config make
make install

然后在php的php.ini的配置文件添加

echo "extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ldap.so" >> /etc/php.ini


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM