How to upgrade PHP on CentOS 5

- by

I’ve learnt a lot since this article went up – including how to do this properly. This article is left here for historic purposes. Read how to upgrade PHP on CentOS 5 on my other site The WordPress Guru

Original Article:

An account of events – not dramatized

yesterday, 09:12

Idea:

The need for amazing shopping cart software arises. Decided to install CRE Loaded on my website. Tried it a year ago, didn’t work. Better luck this time.

11:23

Installed the package, but found that minimum requirement is PHP 5.2.x – I have an older version. Hm. Must upgrade. What a challenge.

11:37

Huge Google search for “how to upgrade PHP on CentOS 5” brings up 90 million articles, all about something different than my question. Currently don’t’ even know what the hell a SSH connection is or what it stands for

12:08

Through sheer luck stumbled onto option to access my server via SSH. Feel very confident now that I can execute command line things and poke around professionally

12:27

Found that upgrading PHP is only possible using something funky called YUM. Must install that first.

13:01

Another Google search begins – WTF is YUM and why do I need it?

13:44

Stopped asking questions. Determined to get this going.

the next day, 17:55

Excited to have found this list – a detailed account of how to do it. Of course, the 10000 characters cannot be copied and pasted – just to drive us all completely nuts

18:37

Tried it. Doesn’t work. Pissed off with all things internet now. Giving up in search for another solution.

CONCLUSION:

pHP on CentOS can’t be upgraded by human beings. And if it can, I never met one of them. Just like Lottery winners. Time to find a different hobby, maybe connected to the outdoors. Hacking wood or drive-by shooting pigeons maybe.



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

2 thoughts on “How to upgrade PHP on CentOS 5”

  1. When you first installed the operating system, if you did it yourself, why did you choose to steer from the default settings?

    That aside Red Hat Enterprise Linux, Fedora, and CentOS (since it is an open source rehash of RHEL) are all RPM (this stands for Red Hat Package Manager) based Distros of Linux. Whether or not you have YUM, which is not required for updating (but does make it easier for novices), you can use an RPM to upgrade applications as such.

    “rpm -qa PHP”

    First to see if PHP actually is installed by an RPM, and if so if it is the CentOS RPM.
    If it is the CentOS RPM then PHP is installed in the default location. Great! Most likely you also have the default php.ini, and if not go ahead and backup that file. Now is a great time to learn how to do it. If you do not want to deal with finding the CentOS RPM, that is fine you can easily uninstall it, which will not harm things since it was a default install anyways. Once you have done that you need to get the newest PHP minor version in the major tree required, or just the newest Stable, which is 2.3.0 at this particular time.

    If you cannot find an RPM via Google you can always use the PHP provided tarball to compile, if you have GCC and compilers installed. RPMs can do that easily.

  2. It’s funny reading this 9 months later – what a great record of how far my web development studies have come since. Back then I didn’t even know what YUM or SSH was, and now I’ve got a couple of servers running with 30+ website projects.

    What I know now of course is that you can’t upgrade PHP on CentOS – with or without YUM – unless Red Hat decide to integrate a later version of PHP. The only way to do this otherwise would be to build your own Linux distribution from source, using the CentOS ingredients, include a newer version of PHP and then rebuild the server. But that would be silly.

    An easier way is to use something other than CentOS as your server OS, like Debian or Fedora I guess (whichever one comes with the components you’re looking for). On V-Server systems you may not have that choice, but on a dedicated server you can pretty much install what you want. In all likelyhood, your provider probably has a list of choices (I know 1 and 1 do).

    I suppose the choice is “bleeding edge” and potentially unstable, or “slightly outdated” but rock solid. I went with the latter and have no regrets.

Comments are closed.