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

在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

你可能感兴趣的:(解決 64 CPU 位元 compiler 時 zlib 出现。(php安装过程中遇到的问题))