解決 64 CPU 位元 compiler 時 zlib 出现。(php安装过程中遇到的问题)

本文介绍PHP编译安装过程中的配置选项,并针对在编译过程中遇到的典型问题提供解决方案,例如如何正确配置zlib及处理相关错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在php编译完成后./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/libgd --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets --with-snmp --enable-short-tags,

执行make后出报错:

/usr/local/zlib/lib/libz.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make: *** [libphp5.la] Error 1

解决办法:

cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure //
使用64位元的方法进行编译
make
make install
make clean

注意:如果./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local/libgd --enable-gd-native-ttf --with-ttf --enable-gd-jis-conv --with-freetype-dir=/usr/local/freetype --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr --with-zlib-dir=/usr/local/zlib --enable-xml --enable-mbstring --enable-sockets --with-snmp --enable-short-tags提示错误,说不支持snmp,我们可以先安装net-snmp,然后再指定路径

--with-snmp=/usr/local/net-snmp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值