下面进行编译安装PHP7.0,编译安装最头疼的就是因为某些类库没有安装而报错,所以编译前请确保以下包已安装。

$ yum groupinstall "development tools"

$ yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype \
freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel \
glib2 glib2-devel bzip2 bzip2-devel ncurses curl curl-devel openssl-devel gdbm-devel db4-devel \
libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel

先去官网下载PHP7.0即可,官方地址:

$ tar xvf php-7.0.10.tar.gz
$ cd php-7.0.10

进行编译前配置,我添加了一些常用的扩展。

$ ./configure \
--prefix=/usr/local/php \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli \
 --with-openssl \
 --with-pcre-regex \
 --with-pdo-mysql \
 --with-pdo-sqlite \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip

然后进行编译和安装

$ make
$ make install

完结。

原文来自:http://www.ywnds.com/?p=6001

本文地址:https://www.linuxprobe.com/php-compilation-install.html编辑:何云艳,审核员:逄增宝