Centos7.2 compile and install PHP7 and centos7.2 compile php7
The procedure is as follows:
1. Install Dependencies
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
2. Download the PHP source code package
wget http://cn2.php.net/distributions/php-7.0.27.tar.gz
3. Configure Parameters
./configure --prefix=/alidata/server/php-7.0.27 \--with-apxs2=/alidata/server/httpd-2.4.10/bin/apxs \--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
4. Compile
make
Note: The error message "undefined reference to 'libiconv _ open'" appears here. Add the ZEND_EXTRA_LIBS = '-liconv' parameter to make, as shown below:
make ZEND_EXTRA_LIBS='-liconv'
5. Installation
make install
6. After the installation is completed, handle the problem
6.1 set the alidata/server/php soft link to alidata/server/php-7.0.27
cd /alidata/www/serverrm -rf phpln -s /alidata/server/php-7.0.27 php
6.2 enable the PHP 7 module in the httpd. conf file
#LoadModule php5_module modules/libphp5.soLoadModule php7_module modules/libphp7.so
6.4 restart Apache
systemctl stop httpdsystemctl start httpd