继续诡异的问题。今天在一台Ubuntu 8.10 Server版本上用这样的configure条件:
[code=’sh’]
‘./configure’ \
‘–with-mysql=/usr/local/mysql’ \
‘–with-apxs2=/usr/local/apache/bin/apxs’ \
‘–enable-mbstring’ \
‘–with-mcrypt’ \
‘–with-gd’ \
‘–with-jpeg-dir=/usr/local/’ \
‘–with-png-dir=/usr/lib’ \
‘–enable-exif’
[/code]
第一个问题:
[code=’sh’]
configure: error: libjpeg.(a|so) not found.
[/code]
我以为是libjpeg没装,下好libjpeg-6b.tar.gz,这样装了:
[code=’sh’]
tar -zxvf libjpeg-6b.tar.gz
cd libjpeg-6b
./configure
make
sudo make install
[/code]
但是还是提示上面的错误。很迷惑,后来发现是/usr/lib下没有libjpeg的文件,正确的libjpeg安装应该这样子:
[code=’sh’]
tar -zxvf libjpeg-6b.tar.gz
cd libjpeg-6b
./configure
make
# 这一步很重要!
sudo make install-lib
sudo make install
[/code]
PHP的configure成功结束了,但是make编译PHP 5.2.8时出错:
[code=’sh’]
/home/nocoo/soft/php-5.2.8/main/output.c:421:
undefined reference to `php_ob_gzhandler_check’
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php] Error 1
[/code]
大惑不解,然后我搜我搜我搜搜搜,终于发现,只需要加入’–with-zlib’就可以让PHP用zlib,从而消除了这个配置错误。
最终正确的configure命令如下:
[code=’sh’]
‘./configure’ \
‘–with-mysql=/usr/local/mysql’ \
‘–with-apxs2=/usr/local/apache/bin/apxs’ \
‘–enable-mbstring’ \
‘–with-mcrypt’ \
‘–with-zlib’ \
‘–with-gd’ \
‘–with-jpeg-dir=/usr/local/’ \
‘–with-png-dir=/usr/lib’ \
‘–enable-exif’
[/code]
为了达成这样一个PHP configure,当中我装过的lib列表如下:
- libxml2-sources-2.7.2.tar.gz
- zlib-1.2.3.tar.gz
- libmcrypt-2.5.8.tar.gz
- libpng-1.2.34.tar.gz
- libjpeg-6b.tar.gz
- gd-2.0.35.tar.gz
因为简单执行:
[code=’sh’]
tar -zxvf {target}.tar.gz
cd {target}
./configure
make
sudo make install
[/code]
就成功了,所以这里没什么好说的,你要是缺,也装上即可。