紫悦博客

不进则退,退一步万丈悬崖!

0%

CentOS编译安装PHP常用扩展及编译安装PHP

一、扩展安装

1、安装zlib

1
2
3
wget ​http://zlib.net/zlib-1.2.8.tar.gz
tar -zxf zlib-1.2.8.tar.gz
cd zlib-1.2.8
1
./configure --prefix=/usr/local/zlib
1
2
make
make install​

 

2、安装​freetype

说明:FreeType库是一个完全免费(开源)的、高质量的且可移植的字体引擎​

地址:http://sourceforge.net/projects/freetype/files/freetype2/2.5.5/​

1
2
3
wget http://jaist.dl.sourceforge.net/project/freetype/freetype2/2.5.5/freetype-2.5.5.tar.gz
tar -zxf freetype-2.5.5.tar.gz
cd freetype-2.5.5
1
2
3
./configure --prefix=/usr/local/freetype --enable-shared
make
make install​

3、安装libpng​

说明:gd库需要​,最新版是1.6.16,但是和zlib1.2.8不兼容,就选择了1.5.21

地址:http://jaist.dl.sourceforge.net/project/libpng/libpng15/older-releases/1.5.23/​

http://jaist.dl.sourceforge.net/project/libpng/libpng15/1.5.21/libpng-1.5.21.tar.gz

1
./configure --prefix=/usr/local/libpng/ --enable-shared --with-zlib-prefix=/usr/local/zlib/
1
2
make
make install

小提示:如果有错误,可以执行make clean,然后再make试试​

4、安装libtiff

地址:http://jaist.dl.sourceforge.net/project/libpng/libpng15/older-releases/1.5.23/​

地址:http://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz​

1
./configure --prefix=/usr/local/libtiff --enable-shared
1
2
make
make install​

5、安装jpeg

地址:http://jaist.dl.sourceforge.net/project/libpng/libpng15/older-releases/1.5.23/​

地址:​http://www.ijg.org/files/jpegsrc.v9a.tar.gz

1
./configure --prefix=/usr/local/jpeg --enable-shared
1
2
make
make install​

 

6、安装libgd

1
wget https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.1.tar.gz
1
./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/libtiff
1
2
make
make install​

7、安装PHP​

1
2
3
​wget http://cn2.php.net/distributions/php-5.6.5.tar.gz
tar -zxf php-5.6.5.tar.gz
cd php-5.6.5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
./configure  --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/php/etc \
--with-pic --enable-mbstring \
--enable-inline-optimization \
--disable-static --with-regex=system \
--with-gettext --with-gd --with-zlib --with-gdbm --disable-debug \
--enable-safe-mode --enable-sysvmsg --enable-sysvsem \
--enable-sysvshm --enable-ftp --enable-xml \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf --with-gmp --with-iconv \
--with-jpeg-dir=/usr/local/jpeg --with-libexpat-dir=/usr \
--enable-bcmath --enable-exif --enable-sockets --enable-wddx \
--enable-calendar --enable-shmop --enable-soap --enable-zend-multibyte \
--enable-magic-quotes --with-pear --with-curl \
--with-mcrypt=/usr/local/libmcrytp \
--enable-pcntl \
--enable-zip --with-openssl \
--with-tidy
1
2
3
make
make test
make install