How to upgrade to PHP 7 on RHEL/CentOS

TL;DR = Upgrade to PHP 7 using Remi’s RPM repository – PHP Configuration wizard.

Red Hat Enterprise Linux (RHEL) is a Linux distribution developed by Red Hat targeted toward the commercial market. Red Hat uses strict trademark rules to restrict free re-distribution of its officially supported versions, but still freely provides its source code. Third-party derivatives such as CentOS is built and redistributed by stripping away non-free components.

One of the main advantages of RHEL/CentOS is that they run only the most stable versions of packaged software. This greatly reduces the risk of crashes and errors. Users who install RHEL/CentOS also gain access to years of enterprise-level security updates. All of this stability and security comes with a few trade-offs. One of which is that newer software packages are less likely to be supported and in this case… PHP 7. RHEL/CentOS lacks official support for PHP 7, or PHP 5.6 for that matter, which hits EOL (end of life) in a few months. What’s available is PHP 5.4 on the latest RHEL/CentOS 7, while RHEL/CentOS 6 supports the very, very, slow PHP 5.3. These versions will remain secure via RHEL’s security patches. Thus, unlike other distros, technically you don’t have to make the that mad dash to upgrade to PHP 7.

 

Ok I got it! I still want PHP 7 (speed!!) on my RHEL/CentOS server.

PHP 7 upgrade Configuration wizard

You’ve been warned, but you still would like to install newer PHP 7 packages on your rock solid RHEL/CentOS server. First, if you find yourself constantly forcing premature upgrades of many software packages on RHEL/CentOS, I would recommend considering migrating to Fedora or other distros such as Ubuntu/Debian. (Read: Best Linux Server Distro by main focus/strength)

However, if you are ONLY going to upgrade PHP and maybe MySQL, you might be ok sticking with RHEL/CentOS for it’s stellar stability/security. That said, be aware that installing newer software packages not yet officially supported makes your distro less stable and less secure. How much less, will largely depend on you or your server admin.

Upgrade to PHP 7, you can use Fedora’s Extra Packages for Enterprise Linux (EPEL).
Follow the instructions here: http://rpms.remirepo.net/wizard/.
_____________________
Alternatively, follow guidance here: https://wiki.centos.org/HowTos/php7

Tags: , , ,