This article describes how to install the latest PHP 7 version in Centos7. one is simple installation (via yum), and the other is compilation and installation. for details, refer to the following article, for more information about how to install PHP7 in Centos7 # php/php-tp-inst, you can use yum to install PHP7 ), another method is compile and install. for details, refer to this article. For more information, see
Method 1: Simple Installation (via yum)
1. install epel-release
rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
2. install the rpm source of PHP 7
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3. install PHP7
yum install php70w
Method 2: compile and install
1. download php7
wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.1.tar.gz/from/this/mirror
2. decompress php7
tar -xvf php7.tar.gz
3. enter the php Directory
cd php-7.0.4
4. install the dependency package
# Directly copy the following line (excluding this line) yum install libxml2 libxml2-devel openssl-devel extensions bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel ready-devel readline-devel libxslt -devel
5. Compile the configuration (if an error occurs, it is basically because the dependency file in the previous step is not installed)
./configure \--prefix=/usr/local/php \--with-config-file-path=/etc \--enable-fpm \--with-fpm-user=nginx \--with-fpm-group=nginx \--enable-inline-optimization \--disable-debug \--disable-rpath \--enable-shared \--enable-soap \--with-libxml-dir \--with-xmlrpc \--with-openssl \--with-mcrypt \--with-mhash \--with-pcre-regex \--with-sqlite3 \--with-zlib \--enable-bcmath \--with-iconv \--with-bz2 \--enable-calendar \--with-curl \--with-cdb \--enable-dom \--enable-exif \--enable-fileinfo \--enable-filter \--with-pcre-dir \--enable-ftp \--with-gd \--with-openssl-dir \--with-jpeg-dir \--with-png-dir \--with-zlib-dir \--with-freetype-dir \--enable-gd-native-ttf \--enable-gd-jis-conv \--with-gettext \--with-gmp \--with-mhash \--enable-json \--enable-mbstring \--enable-mbregex \--enable-mbregex-backtrack \--with-libmbfl \--with-onig \--enable-pdo \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-zlib-dir \--with-pdo-sqlite \--with-readline \--enable-session \--enable-shmop \--enable-simplexml \--enable-sockets \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-wddx \--with-libxml-dir \--with-xsl \--enable-zip \--enable-mysqlnd-compression-support \--with-pear \--enable-opcache
6. formal installation
make && make install
7. configure environment variables
vi /etc/profile
Append at the end
PATH=$PATH:/usr/local/php/binexport PATH
Execute the command to make the change take effect immediately
source /etc/profile
8. configure php-fpm
cp php.ini-production /etc/php.inicp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.confcp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod +x /etc/init.d/php-fpm
9. start php-fpm
/etc/init.d/php-fpm start
The above is a detailed description of the latest PHP7 version installed under Centos7. For more information, see other related articles in the first PHP community!