tar -zxvf php-5.6.19.tar.gz
yum安装相关依赖
yum install -y zlib-devel fontconfig fontconfig-devel libXpm* libtool* libxml2 libxml2-devel curl curl-devel
yum -y install make gcc-c++
安装 yasm-1.3.0
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install
安装libmcrypt-2.5.8
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
安装 libvpx-v1.3.0
xz -d libvpx-v1.3.0.tar.xz
tar -xvf libvpx-v1.3.0.tar
cd libvpx-v1.3.0
./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
make && make install
安装tiff-4.0.3
tar zxvf tiff-4.0.3.tar.gz
cd tiff-4.0.3
./configure --prefix=/usr/local/tiff --enable-shared
make && make install
安装libpng-1.6.16
xz -d libpng-1.6.16.tar.xz
tar -xvf libpng-1.6.16.tar
cd libpng-1.6.16
./configure --prefix=/usr/local/libpng --enable-shared
make && make install
安装freetype-2.5.4
tar zxvf freetype-2.5.4.tar.gz
cd freetype-2.5.4
./configure --prefix=/usr/local/freetype --enable-shared --without-png
make && make install
jpegsrc.v9a
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=/usr/local/jpeg --enable-shared
make && make install
libgd-2.1.1
tar zxvf libgd-2.1.1.tar.gz
cd libgd-2.1.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/tiff \
--with-vpx=/usr/local/libvpx
make && make install
t1lib-5.1.2
tar zxvf t1lib-5.1.2.tar.gz
cd t1lib-5.1.2
./configure --prefix=/usr/local/t1lib --enable-shared
make without_doc
make install
\cp -frp /usr/lib64/libltdl.so* /usr/lib/
\cp -frp /usr/lib64/libXpm.so* /usr/lib/
export LD_LIBRARY_PATH=/usr/local/libgd/lib
cd php-5.6.19
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \ # mysql路径
--with-mysqli=/usr/local/mysql/bin/mysql_config \ # mysql_config文件路径
--with-mysql-sock=/tmp/mysqld.sock \ # mysql sock文件路径
--with-pdo-mysql=/usr/local/mysql \ # mysql安装路径
--with-gd --with-png-dir=/usr/local/libpng \
--with-jpeg-dir=/usr/local/jpeg \
--with-freetype-dir=/usr/local/freetype \
--with-xpm-dir=/usr/ \
--with-vpx-dir=/usr/local/libvpx/ \
--with-zlib-dir=/usr/local/zlib \
--with-t1lib=/usr/local/t1lib \
--with-iconv \
--enable-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-opcache \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-mcrypt \
--with-curl \
--enable-ctype
centos上没有安装mysql,php编译选项如下
yum install -y mysql-devel
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=mysqlnd \
--enable-pdo \
--with-pdo-mysql=mysqlnd \
--with-gd --with-png-dir=/usr/local/libpng \
--with-jpeg-dir=/usr/local/jpeg \
--with-freetype-dir=/usr/local/freetype \
--with-xpm-dir=/usr/ \
--with-vpx-dir=/usr/local/libvpx/ \
--with-zlib-dir=/usr/local/zlib \
--with-t1lib=/usr/local/t1lib \
--with-iconv \
--enable-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-opcache \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--enable-session \
--with-mcrypt \
--with-curl \
--enable-ctype
最后一步
make && make install
cp php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录
rm -rf /etc/php.ini #删除系统自带配置文件
ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加软链接到 /etc目录
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷贝模板文件为php-fpm配置文件
ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #添加软连接到 /etc目录