Linux下编译PHP5.3 + Apache2.3

先下子php5.3,apache2.3,apr,curl,apr-util,pcre等源码包了。Linux下安装过程如下:

1.安装准备。先安装工具包:

apr:
./configure --prefix=/usr/local/apr
make
make install
apr-util:
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install
g++:
sudo apt-get install g++
pcer:
 ./configure --prefix=/usr/local/pcre
make
make install
curl:
./configure --prefix=/usr/local/curl
make
make install

2.安装apache。

apache:
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so

3.安装php。

php:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/php5 --with-config-file-path=/usr/local/lib  --with-zlib --with-curl=/usr/local/curl

在php安装过程中可能会有如下问题。

Installing PHP SAPI module:       apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp5.la /usr/local/apache2/modules
/usr/local/apr/build-1/libtool --mode=install install libphp5.la /usr/local/apache2/modules/
libtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
libtool: install: install .libs/libphp5.a /usr/local/apache2/modules/libphp5.a
libtool: install: chmod 644 /usr/local/apache2/modules/libphp5.a
libtool: install: ranlib /usr/local/apache2/modules/libphp5.a
libtool: install: warning: remember to run `libtool --finish /home/ligl/src/php5/libs'
Warning!  dlname not found in /usr/local/apache2/modules/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/libphp5.so
chmod: cannot access `/usr/local/apache2/modules/libphp5.so': No such file or directory
apxs:Error: Command failed with rc=65536

在网上有很多人也遇到这个问题,可参考这里。根据最后的答案,应该是php软件包版本的问题,之前下载的是gz格式的,换成bz2格式一切正常。