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.