Home / Linux  / CentOS  / PHP 7 installation through Yum Repo and Source Compile Method

PHP 7 installation through Yum Repo and Source Compile Method

Do us a favor with share this post 🙂

In January 2016 php.net, released new latest version of PHP. This Version comes with new Zend Engine and lots of new features. Here in this articles , I will show you installation  via two method , first one is webtatic yum repository and second method is from source tarball on centos / rhel 7, 6 Version . Now will use in new version of version and provide good functionality for clients.

Features of PHP 7 

Here are some features of PHP 7 , which makes php 7 is different from older version .

  • PHP 7 is twice faster than PHP 5.6 Version.
  • Return and Scaler Type Declarations
  • Anonymous function support
  • 64-bit support
  • Fatal errors are now change as Exceptions
  • Removal of old and unsupported SAPIs and extensions
  • The null coalesce operator (??)

METHOD : 1 :  Install from Yum Repository

  • Configure EPEL and webtactic Repository

Here we are going to configure EPEL and webtactic Repository on CenOS / RHEL 7  and RHEL 6 Version.  Run below command according to your Operating System.

For CentOS / RHEL 7 Server    # rpm -Uvh  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm    # rpm -Uvh  https://mirror.webtatic.com/yum/el7/webtatic-release.rpm    For CentOS  / RHEL 6 Server    #  rpm –Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm    # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm    

After installation of these two repositories on your server then we will go throgh  on our next steps to install php 7 and its module installation , if needed.

  • Find php7 available package and its modules

PHP 7 available in webtactic package list , you can  check through below command .

# yum list php7*    OR    # yum search php7*

Below is Output of last running command.

=========N/S matched: php7 ========================================    php70w.x86_64 : PHP scripting language for creating dynamic web sites    php70w-bcmath.x86_64 : A module for PHP applications for using the bcmath library    php70w-cli.x86_64 : Command-line interface for PHP    php70w-common.x86_64 : Common files for PHP    php70w-dba.x86_64 : A database abstraction layer module for PHP applications    php70w-devel.x86_64 : Files needed for building PHP extensions    php70w-embedded.x86_64 : PHP library for embedding in applications    php70w-enchant.x86_64 : Enchant spelling extension for PHP applications    php70w-fpm.x86_64 : PHP FastCGI Process Manager    php70w-gd.x86_64 : A module for PHP applications for using the gd graphics library    php70w-imap.x86_64 : A module for PHP applications that use IMAP    php70w-interbase.x86_64 : A module for PHP applications that use Interbase/Firebird databases    php70w-intl.x86_64 : Internationalization extension for PHP applications    php70w-ldap.x86_64 : A module for PHP applications that use LDAP    php70w-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling    php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support    php70w-mysql.x86_64 : A module for PHP applications that use MySQL databases    php70w-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases    php70w-odbc.x86_64 : A module for PHP applications that use ODBC databases    php70w-opcache.x86_64 : An opcode cache Zend extension    php70w-pdo.x86_64 : A database access abstraction module for PHP applications    php70w-pdo_dblib.x86_64 : MSSQL database module for PHP    php70w-pear.noarch : PHP Extension and Application Repository framework    php70w-pecl-apcu.x86_64 : APCu - APC User Cache    php70w-pecl-apcu-devel.x86_64 : APCu developer files (header)    php70w-pecl-imagick.x86_64 : Provides a wrapper to the ImageMagick library    php70w-pecl-imagick-devel.x86_64 : Imagick developer files (header)    php70w-pgsql.x86_64 : A PostgreSQL database module for PHP    php70w-phpdbg.x86_64 : Interactive PHP debugger    php70w-process.x86_64 : Modules for PHP script using system process interfaces    php70w-pspell.x86_64 : A module for PHP applications for using pspell interfaces    php70w-recode.x86_64 : A module for PHP applications for using the recode library    php70w-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices    php70w-soap.x86_64 : A module for PHP applications that use the SOAP protocol    php70w-tidy.x86_64 : Standard PHP module provides tidy library support    php70w-xml.x86_64 : A module for PHP applications which use XML    php70w-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol    
  • Install php7 package

#  yum install php70w  -y


  • Verify PHP Version 

# php –v    

METHOD 2  :  Install PHP 7 through Source

STEP 1 :  Install Required Package

Configure EPEL Repository as we discussed in method 1 in CentOs 7 server box through below command and install required package for php 7 installation.

# rpm -Uvh  http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm  

STEP 2 : Download PHP 7 source code from its official website from php.net

 # wget http://php.net/distributions/php-7.0.3.tar.gz    # mv php-7.0.3.tar.gz /opt    # cd /opt    #  tar xzf php-7.0.3.tar.gz


After extract the php source tarball, go into the directory.

# cd /opt/php-7.0.3    # ls

Below is the screencast for files are there after extracted .

php editor php developer php 7

STEP 3 :  Compile and Build

Run the below commands to perform build and compile php 7 source installation.

# ./buildconf –force


May be you will get error of C compiler package or libxml2 or other library dependency to compile such source software. Here I have install on my fresh centos 7 server, your case can be a different , you need to follow the error and install other dependency according to server configuration. Here I had run below command for my dependency package errors.

#  yum install gcc  freetype-devel  libxml2-devel  libmcrypt-devel  pkgconfig bzip2-devel libpng-devel  libpng-devel libjpeg-devel libXpm-devel gmp-devel aspell-devel recode-devel


And again run the ./buildconf –force , after completing the build , proceed for next steps through below commands.


# make    # make install


Module Check Installed 

From below command you will get show compiled in modules .

# php -m



[PHP Modules]  bz2  calendar  Core  ctype  curl  date  exif  fileinfo  filter  ftp  gettext  gmp  hash  iconv  json  libxml  openssl  pcntl  pcre  Phar  readline  Reflection  session  shmop  SimpleXML  sockets  SPL  standard  tokenizer  xml  zip  zlib    [Zend Modules]

Thanks you


Do us a favor with share this post 🙂

A Linux Geek with Freelance Contributor, Server/ Cloud Administrator having 6+ Years experience in Open Source and Cloud Technologies.

Review overview


Time limit is exhausted. Please reload CAPTCHA.