Centos7.2 compile and install PHP7 and centos7.2 compile php7

Source: Internet
Author: User
Tags gmp

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.