how to upgrade php 5.6 to php 7 in centos 6.6

October 14, 2017 1.3k views
PHP CentOS

i have a Centos 6.6 with php 5.6, i need upgrade to php 7

1 Answer

CentOS 6 does not provide PHP 7, so you will need to use a third-party repository. Luckily, there are a number of community projects that provide more recent versions. In this case, we'll use the packages from the IUS Project.

To add their repository, run:

  • curl 'https://setup.ius.io/' -o setup-ius.sh
  • sudo bash setup-ius.sh

Now, you can install the newer PHP packages with:

  • sudo yum install mod_php70u php70u-cli

You can find more details in:

(That tutorial is targeted for at CentOS 7, but the information and caveats should still apply to CentOS 6 as well.)

PHP 7.0 was released on December 3, 2015. It promises substantial speed improvements over previous versions of the language, along with new features like scalar type hinting. This guide explains how to quickly upgrade a PHP 5.x installation on a CentOS 7 system with Apache or Nginx, using community-provided packages.
Have another answer? Share your knowledge.