检查 apache
rpm -qa|grep httpd
如果存在 则 卸载 apache
rpm -e httpd --nodeps
检查 mysql
rpm -qa|grep mysql
如果存在 则 卸载 mysql
rpm -e mysql --nodeps
4.开始安装
4.1 安装apache
cd /usr/local/
tar zxvf httpd-2.2.14.tar.gz
cd httpd-2.2.14
cd srclib/apr
./configure --prefix=/usr/local/apr && make && make install
cd ..
cd apr-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
cd ../..
./configure --prefix=/usr/local/apache2214 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-expires --enable-ssl --enable-modules --enable-rewrite --enable-dav --enable-so --enable-maintainer-mode --with-expat --enable-proxy --enable-headers --enable-deflate && make && make install
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6
./configure --prefix=/usr --with-shared --without-debug && make && make install
2.安装zlib2
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib
make && make install
3.安装PNG
tar zxvf libpng-1.2.26.tar.gz
cd libpng-1.2.26
cp scripts/makefile.linux ./makefile
./configure --prefix=/usr/local/libpng && make && make install
4.安装ttf
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype && make && make install
5.安装JPEG6
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
mkdir -pv /usr/local/libjpeg/{,bin,lib,include,man/man1,man1}
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static && make && make install
如果使用上述方法系统出现如下错误:
./libtool --mode=compile gcc -O2 -I. -c ./jcapimin.c
make: ./libtool: Command not found
make: *** [jcapimin.lo] Error 127
原因在于libtool版本过低导致的,重新下载新版本的libtool以默认方式安装:
wget http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz
tar xvfz libtool-2.2.6a.tar.gz
cd libtool-2.2.6
./configure && make && make install
然后进入jpeg-6b的源码目录,执行:
cd jpeg-6b
mkdir -pv /usr/local/libjpeg/{,bin,lib,include,man/man1,man1}
cp /usr/local/share/libtool/config/config.sub .
cp /usr/local/share/libtool/config/config.guess .
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
make
mkdir -p /usr/local/man/man1
make install
6.安装 libmcrypt-2.5.7.tar.gz
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure && make && make install
7.安装Fontconfig
tar -zxvf fontconfig-2.8.0.tar.gz
cd fontconfig-2.8.0
./configure --prefix=/usr --with-freetype-config=/usr/local/freetype/bin/freetype-config && make && make install
8.安装GD库
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/libgd --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/libjpeg --with-fontconfig
看到如下支持信息,说明我们的安装进展顺利:
Support for PNG library: yes
Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for pthreads: yes
成功提示信息是:Thank you for using PHP.
如果出现错误提示:undefined reference to `libiconv_open’,一般情况此服务器升级过libiconv,解决方法:
生成makefile参数增加–with-iconv=/usr/local即可,具体取决于当时安装libiconv的路径。
继续make和make install。
拷贝一个配置文件作为php.ini