本文演示编译安装
php7.2.5
,并在此基础上演示使用pecl
、phpize
安装扩展库。
编译安装php
请先下载好源码包,复制以下代码为install.sh
,直接执行。
yum install -y zlib-devel ncurses-devel libxml2-devel libstdc++-devel libxml2-devel libmcrypt mhash libevent openssl-devel libcurl-devel mhash-devel libmcrypt-devel
### libiconv-1.16, need by php
cd $dir
tar -xzf libiconv-1.16.tar.gz
cd libiconv-1.16
./configure --prefix=/usr/local/libiconv-1.16
make -j `grep 'processor' /proc/cpuinfo | wc -l`
make install
# add ld.so.conf
echo "" > /etc/ld.so.conf.d/libiconv-1.16.conf
[ -d /usr/local/libiconv-1.16/lib/ ] && echo "/usr/local/libiconv-1.16/lib/" >> /etc/ld.so.conf.d/libiconv-1.16.conf
[ -d /usr/local/libiconv-1.16/lib64/ ] && echo "/usr/local/libiconv-1.16/lib64/" >> /etc/ld.so.conf.d/libiconv-1.16.conf
ldconfig
### freetype-2.10.0, need by php and gd
cd $dir
tar -xjf freetype-2.10.0.tar.bz2
cd freetype-2.10.0
./configure --prefix=/usr/local/freetype-2.10.0 --enable-freetype-config
make -j `grep 'processor' /proc/cpuinfo | wc -l`
make install
### jpegsrc.v9c, need by php and gd
cd $dir
tar -xzf jpegsrc.v9c.tar.gz
cd jpeg-9c/
./configure --prefix=/usr/local/jpeg-9c
make -j `grep