继前两篇文章《Ubuntu-14.04编译安装Apache-2.4.10》和《Ubuntu-14.04编译安装MySQL-5.6.16》之后,本次介绍下PHP-5.5.16的编译安装。

  1. 编译安装GD库

1.1 编译安装Zlib

phpha@asus:~/lamp$ tar -zxf zlib-1.2.8.tar.gz
phpha@asus:~/lamp$ cd zlib-1.2.8
phpha@asus:~/lamp/zlib-1.2.8$ ./configure --prefix=/usr/local/zlib
phpha@asus:~/lamp/zlib-1.2.8$ sudo make
phpha@asus:~/lamp/zlib-1.2.8$ sudo make install

1.2 编译安装PNG

phpha@asus:~/lamp$ tar -zxf libpng-1.6.13.tar.gz
phpha@asus:~/lamp$ cd libpng-1.6.13/
phpha@asus:~/lamp/libpng-1.6.13$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/libpng-1.6.13$ sudo make
phpha@asus:~/lamp/libpng-1.6.13$ sudo make install

1.3 编译安装JPEG

phpha@asus:~/lamp$ tar -zxf jpeg-9a.tar.gz
phpha@asus:~/lamp$ cd jpeg-9a/
phpha@asus:~/lamp/jpeg-9a$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/jpeg-9a$ sudo make
phpha@asus:~/lamp/jpeg-9a$ sudo make install

1.4 编译安装Libiconv

phpha@asus:~/lamp$ tar -zxf libiconv-1.13.tar.gz
phpha@asus:~/lamp$ cd libiconv-1.13/
phpha@asus:~/lamp/libiconv-1.13$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/libiconv-1.13$ sudo make
phpha@asus:~/lamp/libiconv-1.13$ sudo make install

1.5 编译安装FreeType

phpha@asus:~/lamp$ tar -zxf freetype-2.5.3.tar.gz
phpha@asus:~/lamp$ cd freetype-2.5.3/
phpha@asus:~/lamp/freetype-2.5.3$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/freetype-2.5.3$ sudo make
phpha@asus:~/lamp/freetype-2.5.3$ sudo make install

1.6 编译安装GD

phpha@asus:~/lamp$ tar -zxf libgd-2.1.0.tar.gz
phpha@asus:~/lamp$ cd libgd-2.1.0/
phpha@asus:~/lamp/libgd-2.1.0$ ./configure --prefix=/usr/local --with-libiconv-prefix=/usr/local --with-png=/usr/local --with-freetype=/usr/local --with-jpeg=/usr/local
phpha@asus:~/lamp/libgd-2.1.0$ sudo make
phpha@asus:~/lamp/libgd-2.1.0$ sudo make install
  1. 编译安装PHP组件

2.1 编译安装LibXML

phpha@asus:~/lamp$ sudo apt-get install libxml2
phpha@asus:~/lamp$ sudo apt-get install libxml2-dev

2.2 编译安装Mhash

phpha@asus:~/lamp$ tar -zxf mhash-0.9.9.9.tar.gz
phpha@asus:~/lamp$ cd mhash-0.9.9.9/
phpha@asus:~/lamp/mhash-0.9.9.9$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/mhash-0.9.9.9$ sudo make
phpha@asus:~/lamp/mhash-0.9.9.9$ sudo make install

2.3 编译安装LibMcrypt与Mcrypt

# libmcrypt-2.5.8
phpha@asus:~/lamp$ tar -zxf libmcrypt-2.5.8.tar.gz
phpha@asus:~/lamp$ cd libmcrypt-2.5.8/
phpha@asus:~/lamp/libmcrypt-2.5.8$ ./configure --prefix=/usr/local
phpha@asus:~/lamp/libmcrypt-2.5.8$ sudo make
phpha@asus:~/lamp/libmcrypt-2.5.8$ sudo make install
//mcrypt-2.6.8
phpha@asus:~/lamp$ tar -zxf mcrypt-2.6.8.tar.gz
phpha@asus:~/lamp$ cd mcrypt-2.6.8/
phpha@asus:~/lamp/mcrypt-2.6.8$ LD_LIBRARY_PATH=/usr/local/lib ./configure --prefix=/usr/local
phpha@asus:~/lamp/mcrypt-2.6.8$ sudo make
phpha@asus:~/lamp/mcrypt-2.6.8$ sudo make install

2.4 安装CURL

phpha@asus:~/lamp$ sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

2.5 编译安装PHP

phpha@asus:~/lamp/php-5.5.16$ ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring   --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-gd --with-zlib --enable-zip --with-bz2  --without-sqlite3 --without-pdo-sqlite --with-pear
phpha@asus:~/lamp/php-5.5.16$ sudo make
phpha@asus:~/lamp/php-5.5.16$ sudo make install

标签:PHP / Ubuntu