I have php 5.1.6 installed on a centOS server, and I need at least 5.3.2 (but would rather install the latest available 5.* version).

If I run

yum update php

it says it will update to 5.1.6-34.el5_8 (mine is 5.1.6-27.el5_5.3)..... what the heck????

Are the available packages for centOS THAT much behind the current version, or is it because yum will by default only update within the subversion after the second dot (or something) and I need to tell it to give me a more recent version? If so how do I do that?

  • RedHat 5 was released in 2007, time to upgrade to Centos 6. – Andrew Smith Jun 16 '12 at 12:12
  • 2
    @AndrewSmith: CentOS 5 is supported till 2017, so there is no need to upgrade just because it's old, except you really need newer software. – Sven Jun 16 '12 at 12:28
  • 1
    @SvenW Exactly what the user wants: "newer software". He just have two options: upgrade to a newer CentOS version or install php directly. – Matteo Jun 16 '12 at 12:31
  • If centOS is supported till 2017, then I wonder what they mean by "supported", if you can't keep something as vital as php up-to-date. That the php update shouldn't be automated (because it's not fully backward compatible) doesn't mean that it should be impossible Then there exists a plugin for yum that would allow the replacement, but again, I can't install the plugin, so again, what kind of support is this? well sorry for the rant and thenk you all for the answers – matteo Jun 16 '12 at 12:54
  • Because it would break PHP apps. – Andrew Smith Jun 16 '12 at 14:22

You are most likely running old version of Centos (5.5 or even earlier), which doesn't have PHP 5.2.x or 5.3.x in it's repos. You have 2 options: update Centos to a more recent version (5.6 is the first one with PHP 5.3) or use http://iuscommunity.org/About

  • Actually I've found out that there is a php53 package. However, it won't let me install it because it conflicts with the php package. I guess I would have to first remove php, but that sounds risky. Why do they do that? Why do they call the package with another name and defeat the purpose of update? – matteo Jun 16 '12 at 12:29
  • Isn't there a way to install a new version of PHP and have it coexist with the new one, and then configure apache to use different versions for different web directories? I think it used to be common for having both php4 and php5 – matteo Jun 16 '12 at 12:34
  • PHP 5.3.x isn't fully backwards compatible with 5.1.x or 5.2.x - an automated update would be a bad idea. To replace 5.1 with 5.3 use yum replace php --replace-with php53 or something similar (check package names) – c2h5oh Jun 16 '12 at 12:34
  • my yum doesn't recognize the "replace" command nor the "-replace-with" option. I guess my yum version is old too, but it won't update either (only to a slightly less old version) – matteo Jun 16 '12 at 12:44
  • then your only options is to remove old php and install 5.3 – c2h5oh Jun 16 '12 at 12:45

Yes, as I recall getting a newer version of php on CentOs 5.x was mighty painful.

Basically there is a php53 package in the updates repos;

# cat /etc/redhat-release 
CentOS release 5.8 (Final)

# repoquery -i php53

Name        : php53
Version     : 5.3.3
Release     : 7.el5_8
Repository  : updates

but if you run something like this;

 # yum provides php
php-5.1.6-32.el5.x86_64 : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
php-5.1.6-34.el5_8.x86_64 : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)

you will see that php53 package does not actually provide php, which means that installing it will break any packages that depend on php, despite there being a php on the system.

In the end I used a shim rpm that just contained a single provides line, which I found somewhere on the web because all my php requirements were simple.

The alternatives are as @c2h5oh mentioned, to use a 3rd party re-packaged version, (or to upgrade to Centos 6.2 :-< ).

You can see what replacing all the php with php53 will break with the following command;

# rpm --whatrequires -V php
Unsatisfied dependencies for pastebin-0.60-4.el5.noarch: php

You can see from the output of that last command, that in my case I wasn't using any packages that require php that were important, so I just did used --nodeps to force remove all the php.

  • Assuming for a moment that I menage to get the yum-plugin-replace and run "yum replace", does this mean that it won't work anyway?: "you will see that php53 package does not actually provide php, which means that installing it will break any packages that depend on php, despite there being a php on the system." – matteo Jun 16 '12 at 12:58
  • Why not to run both versions and configure apps to use 5.3? This is because 5.3 is not working same as with 5.1 – Andrew Smith Jun 16 '12 at 14:15
  • @matteo show the output of rpm --whatrequires -V php for your system, so we can see what has it as a dependency... – Tom Jun 16 '12 at 15:11
  • @AndrewSmith that would be perfect, how do I do that? – matteo Jun 16 '12 at 16:09
  • @TomH here it is: SM5....T /usr/local/psa/admin/plib/modules/sbm3/upgrade.php – matteo Jun 16 '12 at 16:12

You can use yum shell to perform the remove (of php-*) and install (of php53-*) operations in the same transaction.

  • the problem is that it won't let me remove php without removing Plesk which depends on it (and I guess it doesn't "know" that php53 will be equally fine) – matteo Jun 16 '12 at 16:08
  • Unfortunately that's something you'd have to bring up with Parallels. – Ignacio Vazquez-Abrams Jun 16 '12 at 16:10

Use yum update, then yum upgrade to upgrade CentOS to 5.8, then retry yum update php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.