CentOS 6 64位版本,默认是不会安装32位软件的,这样就导致我们在安装PHP前安装的库,只会有64位版本
例如
yum -y install libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel mhash freetype freetype-devel
这样安装,系统默认只会安装64位版本,假设我们用以下命令去安装PHP
CHOST=”x86_64-pc-linux-gnu” CFLAGS=”-march=nocona -O2 -pipe” CXXFLAGS=”-march=nocona -O2 -pipe” \
./configure –prefix=/usr/local/php \
–with-config-file-path=/etc \
–with-mysql=/usr/loca/mysql –with-pdo-mysql=/usr/local/mysql/bin/mysql_config \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-iconv-dir=/usr/local \
–with-freetype-dir –with-jpeg-dir \
–with-png-dir –with-ttf \
–enable-zip –with-zlib \
–with-gd \
–disable-rpath –enable-discard-path \
–enable-safe-mode –enable-bcmath \
–enable-shmop –enable-sysvsem \
–with-curl –with-curlwrappers \
–enable-fastcgi –enable-force-cgi-redirect \
–enable-mbstring –with-mcrypt \
–disable-ipv6 \
–enable-static \
–enable-maintainer-zts \
–enable-zend-multibyte \
–enable-sockets \
–enable-soap \
–with-openssl \
–without-sqlite –without-pdo-sqlite
则会提示
configure: error: libjpeg.(a|so) not found.
通过rpm -qa |grep libjpeg是有安装的
解决办法是在configure里加入
–with-libdir=lib64
修改后是这样
CHOST=”x86_64-pc-linux-gnu” CFLAGS=”-march=nocona -O2 -pipe” CXXFLAGS=”-march=nocona -O2 -pipe” \
./configure –prefix=/usr/local/php \
–with-libdir=lib64 \
–with-config-file-path=/etc \
–with-mysql=/usr/loca/mysql –with-pdo-mysql=/usr/local/mysql/bin/mysql_config \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-iconv-dir=/usr/local \
–with-freetype-dir –with-jpeg-dir \
–with-png-dir –with-ttf \
–enable-zip –with-zlib \
–with-gd \
–disable-rpath –enable-discard-path \
–enable-safe-mode –enable-bcmath \
–enable-shmop –enable-sysvsem \
–with-curl –with-curlwrappers \
–enable-fastcgi –enable-force-cgi-redirect \
–enable-mbstring –with-mcrypt \
–disable-ipv6 \
–enable-static \
–enable-maintainer-zts \
–enable-zend-multibyte \
–enable-sockets \
–enable-soap \
–with-openssl \
–without-sqlite –without-pdo-sqlite
不过,由于我们MySQL不是用rpm包装的,是自编译安装在/usr/local/mysql
如果使用以上configure参数,则会提示
configure: error: Cannot find libmysqlclient_r under /usr/local/mysql/.
Note that the MySQL client library is not bundled anymore!
此时做个修改
ln -s /usr/local/mysql/lib /usr/local/mysql/lib64
这样就可以configure通过了,然后就make && make install吧
题外话,如果要在CentOS6 64位上yum安装32位的软件
echo ‘multilib_policy=all’ >> /etc/yum.conf
就可以了