Installing PHP 7.2 on Centos 7 armhfp

I have a Raspberry Pi 3 running strip down version of Centos 7 and I wanted to install newer version of PHP on that. Sounds relatively easy task, but because of a bit more exotic ARM-infrastructure it took me four hours! The biggest problem was finding the right working repositories and on the way I managed to broke my package manager etc. multiple times. I did this so that you don’t have to. I’m gonna share how I managed to get it working in the end.

Before we begin, you don’t have to uninstall your existing version of PHP. When you have the right repositories in place YUM will update the packages automatically for you.

First thing is to add Epel repositories into your YUM package manager. There is tens of different instructions how to get this done, but none of those worked for me. Finally got it working with this approach:

# cd /etc/yum.repos.d/
# sudo nano epel.repo

Add following lines to the file and press (Ctrl + O, Enter, Ctrl + X):
[epel]
name=Epel rebuild for armhfp
baseurl=https://armv7.dev.centos.org/repodir/epel-pass-1/
enabled=1
gpgcheck=0

Next we need to add Remi php72 rebuild for armhfp repo.

# sudo nano php72-testing.repo

Add following lines to the file and press (Ctrl + O, Enter, Ctrl + X):
[php72-testing]
name=Remi php72 rebuild for armhfp
baseurl=https://armv7.dev.centos.org/repodir/community-php72-testing/
enabled=1
gpgcheck=0

After that it is good to check the repos are added properly.

# sudo yum repolist

If you see “Epel rebuild for armhfp” and “Remi php72 rebuild for armhfp” listed, everything should be good so far. Next thing is to run the actual update.

# sudo yum update

This should automatically update your PHP to the latest available version. You can check the PHP version by running

# php -v

Thank you. Hopefully this helped so that you didn’t have to go through the same four hour struggle that I had to.

2 thoughts on “Installing PHP 7.2 on Centos 7 armhfp

  1. I followed the procedure exactly as described, but got the error
    “Cannot find a valid baseurl for repo: centos-kernel/7/armhfp”. It seems the the repo does not link to a correct URL
    What could be the missing element?
    Thank you in advance for a reply.
    P.S.
    I’m trying to run the same system on a RPi 3 model B as on a Mac Mini. In preparation for a shift to the RPi4

Leave a Reply

Your email address will not be published. Required fields are marked *