CentOS 6 and 7 environment using yum to install php7

  • 2020-11-03 22:39:48
  • OfStack

This article illustrates how to install php7 from yum in CentOS 6/7 environment. To share for your reference, the details are as follows:

Installing php7 is now an essential tool for linux servers, and any web site will consider using php7. Let's take a look at the Centos 6/7 tutorial using yum to install php7.

The official version of PHP7 was released in early December 2015, ushering in the biggest update since 2004. The most significant change in PHP7 is the significant performance improvement that has brought it close to the PHP execution engine developed by Facebook. In WordPress benchmark performance tests, it was 2 to 3 times faster than version 5.6, significantly reducing memory footprint. There have also been a few language changes to PHP7, such as the addition of return type declarations and the addition of new reserved keywords. On the security side, remove the PHP safe mode, add magic quotes, etc. Not only that, the new version supports 64-bit and includes the latest version of the Zend engine.

View the centos version


# cat /etc/centos-release

Delete the previous version of php


# yum remove php* php-common

rpm installs the corresponding yum source for Php7

CentOS/RHEL 7.x:


# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:


# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

yum installation php7


# yum install php70w php70w-opcache

Install additional plug-ins (optional)


php70w
php70w-bcmath
php70w-cli
php70w-common
php70w-dba
php70w-devel
php70w-embedded
php70w-enchant
php70w-fpm
php70w-gd
php70w-imap
php70w-interbase
php70w-intl
php70w-ldap
php70w-mbstring
php70w-mcrypt
php70w-mysql
php70w-mysqlnd
php70w-odbc
php70w-opcache
php70w-pdo
php70w-pdo_dblib
php70w-pear
php70w-pecl-apcu
php70w-pecl-imagick
php70w-pecl-xdebug
php70w-pgsql
php70w-phpdbg
php70w-process
php70w-pspell
php70w-recode
php70w-snmp
php70w-soap
php70w-tidy
php70w-xml
php70w-xmlrpc

Restart Apache


# service httpd restart

If it is Apache + PHP you must use PHPIniDir to specify the path to php.ini, the configuration file for php5

PHPINIDir /etc/php.ini

I hope this article has helped you with your CentOS server configuration.


Related articles: