Install the latest version of PHP7 under Centos7

PHP7 official website download
http://php.net/downloads.php

Some preparations before installation,

  • If you want to install the gd module, you need to install the following dependencies
    sudo yum install -y libpng libpng-devel

  • If you want to include BZip2 support, you need to install the following dependencies
    sudo yum install -y bzip2 bzip2-devel

  • If you want to include curl support, you need to install the following dependencies
    sudo yum install -y curl curl-devel

decompress
tar -xf php-NN.tar.gz

Configuration parameters
sudo ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-gd \
--with-bz2 \
--with-zlib \
--with-curl \
--enable-mbstring \
--enable-zip \
--enable-fpm \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql

Parameter explanation, add as needed.
--with-apxs2=/usr/local/apache2/bin/apxs \#associated apache2
--with-gd \#PHP gd module #includes
--with-bz2 \BZip2 support #includes
--with-zlib \ZLIB support #includes
--enable-zip \Zip read and write support #includes
--with-curl \cURL support #enables
--enable-mbstring \multibyte string support #enables
--enable-fpm \PHP-FPM process management
--enable-mysqlnd \#Enable mysqlnd explicitly #includes
--with-mysqli \mysql support
--with-pdo-mysql#includes mysql support

compile
make

Install
make install

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326075877&siteId=291194637