If you are still using the Fedora Core 4 (FC4) version of Linux you may have a need to upgrade your version of PHP. Unfortunately the Fedora Project hasn’t put out an update to PHP past version 5.0.4. There have been some functionality updates to PHP since then. The project I was working on at the time needed the functionality of SimpleXML (for handling XML responses; built into PHP 5.1.4 or higher).
The easiest way to upgrade PHP on Fedora, in my opinion, is using YUM. YUM makes it easy to download and install rpm packages on Linux systems. So let’s take a look at what we need to do.
This entry is sort of a Part 2 to a post I made earlier about some problems I had with YUM updates.
Normally with YUM finding and installing a package is as easy as running the following line while logged in as root:
[root@yourlinuxbox ~]# yum -y update php
YUM does all the hard work behind the scenes finding the latest package in this instance it will be the most current PHP package. YUM will download it and install it. Now here comes our problem, as I stated before, there is no updated package for Fedora Core 4 beyond 5.0.4 in the Fedora Projects repository. When you run the line above you will get output similar to this:
[root@yourlinuxbox yum.repos.d]# yum -y update php
Setting up Update Process
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Could not find update match for php
No Packages marked for Update/Obsoletion
So now what? Well luckily John Dusbabek ran into this same problem and figured it out for us. I will show you exactly what I did to update PHP on the Fedora Core 4 box I was working on using John’s helpful instructions. Run the following commands:
cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/remi-fedora.repo
You will see some output as the file you need remi-fedora.repo is downloaded to your Linux box. Your next step is to see what the current package for PHP is:
yum --enablerepo=remi list php
You will see output like this:
Setting up repositories
updates-released 100% |=========================| 951 B 00:00
remi 100% |=========================| 2.0 kB 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Installed Packages
php.i386 5.0.4-10.5 installed
Available Packages
php.i386 5.2.9-1.fc4.remi remi
As we can see from the output above, the current package for PHP is version 5.2.9. We are now ready to use YUM to update your PHP installation. Run the following command:
yum --enablerepo=remi install php-5.2.9
Obviously if the current version number is different when you do the list command, substitute that version in the above command. This part may take a bit of time as YUM downloads the packages needed and installs them. You will see a ton of output during this step. The real beauty of using YUM is that it detects, downloads and installs all the packages you need plus any dependency packages that may be needed. Trust me that can be a real pain if doing you are doing it manually. You may see some warnings during the installation, unfortunately this is not an official release from the Fedora Project, so use caution if doing this on a production server.
Once it is done you will see a message saying that it is complete. Then restart Apache to use the new version of PHP with all the updated functions. You can restart Apache with this command:
apachectl restart
That’s it! Pretty simple huh? Well maybe not but thanks again to John Dusbabek and Trent Reimer for finding the location of the updated PHP package.
Hard to imagine that after only a month this no longer appears to work. Can you confirm that it still does?
Hi Matt,
Where exactly is this failing? Any info you can provide will help me to track down what the problem is.
Thanks,
William
su -
cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/remi-...
I am trying to upgrade PHP/MySQL on FC4 and when I do what is listed above I get the following error(s):
[root@s15268048 yum.repos.d]# yum –enable remi list php
Setting up Install Process
Setting up repositories
Cannot find a valid baseurl for repo: updates-released
Error: Cannot find a valid baseurl for repo: updates-released
I apologize if I am doing something wrong, but when looking at the .repo file it appears that the url’s are not correct.
Thanks for the help!