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.