源码编译PHP5.6
//更新依赖
sudo apt-get update
sudo apt-get install build-essential
//安装依赖
sudo apt-get install -y autoconf libtool re2c libxml2-dev openssl libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libfreetype6-dev libldap2-dev libmcrypt-dev libmysqlclient-dev libxslt1-dev libxt-dev libpcre3-dev libxpm-dev libt1-dev libgmp-dev libpspell-dev librecode-dev libreadline6-dev bison libtidy-dev libxpm-dev libssl-dev libgmp-dev
//链接到合适的地方
sudo ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
//下载PHP源码
wget -O php.tar.xz https://secure.php.net/get/php-5.6.32.tar.xz/from/this/mirror
//解压源码
tar -Jxf /usr/src/php.tar.xz -C /usr/src/php --strip-components=1
//更新依赖
sudo apt-get update
sudo apt-get install build-essential
//安装依赖
sudo apt-get install -y autoconf libtool re2c libxml2-dev openssl libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libfreetype6-dev libldap2-dev libmcrypt-dev libmysqlclient-dev libxslt1-dev libxt-dev libpcre3-dev libxpm-dev libt1-dev libgmp-dev libpspell-dev librecode-dev libreadline6-dev bison libtidy-dev libxpm-dev libssl-dev libgmp-dev libpspell-dev libsnmp-dev
//链接到合适的地方
sudo ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
//configure
sudo ./buildconf
sudo ./configure \
--prefix=/usr/local/etc/php \
--includedir=/usr/include \
--enable-opcache \
--enable-ctype \
--enable-fpm \
--enable-tokenizer \
--enable-fileinfo \
--enable-pdo \
--enable-sockets \
--enable-exif \
--enable-soap \
--enable-ftp \
--enable-wddx \
--enable-pcntl \
--enable-soap \
--enable-bcmath \
--enable-mbstring \
--enable-dba \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-zip \
--enable-calendar \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-mysqli \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gettext \
--with-xmlrpc \
--with-openssl \
--with-mhash \
--with-mcrypt \
--with-xsl \
--with-curl \
--with-pcre-regex \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-zlib-dir=/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--with-gettext=/usr \
--with-zlib=/usr \
--with-bz2=/usr \
--with-recode=/usr \
--with-ldap \
--with-pear \
--with-readline \
--with-config-file-path=/usr/local/etc/php \
--with-config-file-scan-dir=/usr/local/etc/php/conf.d
//生成和安装
make
sudo make install