INSTALL PHP 7 ON CENTOS

Share

PHP 7 release on december 3 2015, it has also been updated to PHP 7.0.1 on December 17 2015. bringing not just advanced features and tweaked performance but also several bugs has been fixed.

PHP 7.0.0 comes with a new version of the Zend Engine, numerous improvements and new features such as :

  • Improved performance: PHP 7 is up to twice as fast as PHP 5.6
  • Significantly reduced memory usage
  • Abstract Syntax Tree
  • Consistent 64-bit support
  • Improved Exception hierarchy
  • Many fatal errors converted to Exceptions
  • Secure random number generator
  • Removed old and unsupported SAPIs and extensions
  • The null coalescing operator (??)
  • Return and Scalar Type Declarations
  • Anonymous Classes
  • Zero cost asserts

Oke Let’s Get Started to the tutorials 🙂

Tutorial How to install PHP 7 – or upgrade to PHP 7

INSTALL PHP 7 ON CENTOS / RHEL

1. Using Webtatic Repo

Step 1 – Login to your CentOS server as root or as a user with sudo privilege with Putty or other

Step 2 – Do yum update to make sure all packages are up to date:

yum update -y

Step 3 – Install Apache 2 web server (httpd):

yum install httpd -y

Step 4 – Add webtatic repository in your CentOS 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

However if you are still using CentOS 6.x, then use this instead:

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

Step 5 – Now finally you can install PHP 7 using command below:

yum install php70w

Step 6 – You may also need to install several common PHP 7 modules. List it using command below:

yum search php70w-

Need a shortcut? Here’s the command to install PHP modules which are usually needed by many apps:

yum install php70w-cli php70w-common php70w-bcmath php70w-dba php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-odbc php70w-opcache php70w-pdo php70w-pdo_dblib php70w-pear php70w-process php70w-pspell php70w-recode php70w-tidy php70w-xml php70w-xmlrpc

2. Using Remi repo

Step 1 – Login to your CentOS server as root or as a user with sudo privilege via putty or other

Step 2 – Do yum update to make sure all packages are up to date:

yum update -y

Step 3 – Install Apache 2 web server (httpd):

yum install httpd -y

Step 4 – Add EPEL and Remi repository in your CentOS 7.x:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm

However if you are still using CentOS 6.x, then use this instead:

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm

Step 5 – Then now update your yum repo list

yum --enablerepo=remi update remi-release

Step 6 – Now finally you can install PHP 7 using command below:

yum --enablerepo=remi-php70 install php70

Step 7 – You may also need to install several common PHP 7 modules. List it using command below :

yum --enablerepo=remi-php70 search php70-

Need a shortcut? Here’s the command to install PHP modules which are usually needed by many apps:

yum --enablerepo=remi-php70 install php70w-cli php70w-common php70w-bcmath php70w-dba php70w-devel php70w-embedded php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-odbc php70w-opcache php70w-pdo php70w-pdo_dblib php70w-pear php70w-process php70w-pspell php70w-recode php70w-tidy php70w-xml php70w-xmlrpc

Now you can verify it using php -v command:

See ? It is PHP 7.0.1 with Zend Engine v3.0.0 and Zend OPcache v7.0.6-dev. How cool is that ? 🙂

Thanks for reading, don’t hestiate comment if you have a trouble installing PHP 7 on CentOS

Leave A Reply