1.环境说明
ubuntu 12.04
源码存储路径 /home/wzw/workstation
安装路径 /home/wzw/workstation
切换到工作目录 cd /home/wzw/workstation
2.安装
2.1 libmcrypt
mkdir libmcrypt
wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
sudo ./configure --prefix=/home/wzw/workstation/libmcrypt --enable-dynamic-loading
sudo make
sudo make install
2.2 freetype
mkdir freetype
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.gz
tar -zxvf freetype-2.4.0.tar.gz
cd freetype-2.4.0/
sudo ./configure --prefix=/home/wzw/workstation/freetype
sudo make
sudo make install
2.3 libpng
mkdir libpng
wget http://jaist.dl.sourceforge.net/project/libpng/libpng10/1.0.60/libpng-1.0.60.tar.gz
tar -zxvf libpng-1.0.60.tar.gz
cd libpng-1.0.60/
sudo ./configure --prefix=/home/wzw/workstation/libpng
sudo make
sudo make install
2.4 libjpeg
mkdir libjpeg
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
tar -zxvf jpegsrc.v9.tar.gz
cd jpeg-9
sudo ./configure --prefix=/home/wzw/workstation/libjpeg
sudo make
sudo make install
2.5 gd
mkdir gd2
wget https://bitbucket.org/libgd/gd-libgd/get/GD_2_0_33.tar.gz
tar -zxvf GD_2_0_33.tar.gz
cd libgd-gd-libgd-486e81dea984/src
sudo ./configure --prefix=/home/wzw/workstation/gd2 --with-png=/home/wzw/workstation/libpng --with-freetype=/home/wzw/workstation/freetype --with-jpeg=/home/wzw/workstation/libjpeg
sudo make
#[出错:gd_png.c:15:53: fatal error: png.h: No such file or directory
#locate png.h
#解决:edit gd_png.c replace png.h to /usr/lib/syslinux/com32/include/png.h at line 15]
sudo make install
2.6 重新编译安装 php
cd php-5.3.27
sudo ./configure --prefix=/home/wzw/workstation/php5 --with-config-file-path=/home/wzw/workstation/php5/etc/php.ini --with-mysql=/home/wzw/workstation/mysql5 --with-pdo-mysql=/home/wzw/workstation/mysql5 --with-mysqli=/home/wzw/workstation/mysql5/bin/mysql_config --enable-magic-quotes --enable-static --enable-mbstring --enable-sockets --enable-zip --with-curl --with-libxml-dir --enable-fpm --enable-zip --enable-soap --with-gd=/home/wzw/workstation/gd2 --with-mcrypt=/home/wzw/workstation/libmcrypt
sudo make
sudo make install
3.重启php-fpm
重启php-fpm后,查看phpinfo中是否加载了安装的扩展。
cd /home/wzw/workstation/env/php5
sudo ./sbin/php-fpm -y ./etc/php-fpm.conf # 重启
./bin/php -m
参见下图
本文来自博客园,作者:孙龙-程序员,转载请注明原文链接:https://www.cnblogs.com/sunlong88/articles/8681702.html