Need to update php in Centos 7

My new Virtualmin server is Centos 7 but the php version is PHP 5.4.16 which is old, no updates for it. How can I update that safely? Is there a safe repository I can use?

Please google up Centos 7 and backporting. There are huge amount of articles explaining what is going on. To put it short - your PHP is fine, updated and secured from all know bugs/exploits.

I updated to PHP 7.1 with the following procedure:

  1. install EPELwget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -ivh epel-release-latest-7.noarch.rpm
  2. Install REMI repo:wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
    rpm -Uvh remi-release-7.rpm
  3. Configure the new repo to download PHP 7.1 and replace your old (current) php:cd /etc/yum.repos.d/
    vi remi-php71.repo
    –> In [remi-php71], be sure you have: enabled=1
    vi remi.repo
    –> In [remi] be sure you have: enabled=0
    vi remi-safe.repo
    –> in [remi-safe] be sure you have: enabled=1

    4 Updateyum clean all
    yum update
  4. check:php -v

I did this based on: http://ilovevirtualmin.com/tag/virtualmin-upgrade-php-5-3-to-php-5-4/.

Please check the recomendations on apache’s php conf


Hope it helps

You can have multiple PHP versions installed. I just installed 5.6.5 in addition to 5.4.16 in CentOS 7.3. I did it because I was running into software that wouldn’t install unless PHP was higher than 5.4.

I followed the instructions here: https://virtualmin.com/documentation/web/multiplephp#toc-installing-php-56-on-centos-7-wHWbead3

With the exception that the rpm url returned a 404, so Used this one instead:
https://www.softwarecollections.org/repos/rhscl/rh-php56/epel-7-x86_64/noarch/rhscl-rh-php56-epel-7-x86_64.noarch.rpm

Worked without any issues. Just need to visit any virtual domain that needs the higher version and select it.

Thank you, that worked perfectly!

Most web software that I use which utilize php announced that they were no longer supporting php 5.4 about 3-6 months ago.

I haven’t upgraded from 7 to 7.1 yet because 7.1 came out so close on the heels to 7.0 and I haven’t read any security updates stating that you should. (coming from my old network infrastructure/security experience not that I’m any Linux expert by any stretch of the imagination)

My install of CentOS 7 already had a multi edition of php from 5.6 to 7.0. Of course Linode purposefully adds or subtracts items to make it easier to customize so I may have just been blessed.