How do I install PHP 5.3 on CentOS?
I have to install PHP 5.3 on my CentOS server. If I do yum install php
, the base repository installs 5.1.6 which is too old for the applications I need to install. So I've been trying to use the IUS repository, following the official instructions from IUS:
root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1-2.ius.el5.noarch.rpm
root@linuxbox ~]# wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-1-1.ius.el5.noarch.rpm
root@linuxbox ~]# rpm -Uvh ius-release*.rpm epel-release*.rpm
OK. Now I simply do yum install php53
, etc. for all I need... but I get this error:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Check Error:
file /usr/bin/php from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /usr/bin/php-cgi from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /usr/share/man/man1/php.1.gz from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /etc/php.ini from install of php53u-common-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-common-5.1.6-27.el5_5.3.x86_64
Error Summary
-------------
I have no idea on how to solve this. I think I have to delete the base packages. However, as someone new to Linux, I don't know how to do that.
Update: Apparently RHEL 5.6 includes PHP 5.3, so this will be showing up natively for CentOS soon.
file /usr/bin/php from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /usr/bin/php-cgi from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /usr/share/man/man1/php.1.gz from install of php53u-cli-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-cli-5.1.6-27.el5_5.3.x86_64
file /etc/php.ini from install of php53u-common-5.3.4-3.ius.el5.x86_64 conflicts with file from package php-common-5.1.6-27.el5_5.3.x86_64
The problem here is that the packages you are installing have a different name (php53 instead of php), but they attempt to install the same files...hence the conflicts. This isn't necessarily the best way to put the packages together, but I don't know if there are better packages available so we'll ignore that.
To remove your currently installed packages:
# yum remove php-cli php-common php
So, in general, yum remove <list of packages>
will remove the packages. And of course, yum list installed
to see a list of installed packages (or rpm -qa
).
The answer to this has changed, as of January 13th, 2011. Red Hat has released version 5.6, and this includes PHP version 5.3 as a separate package (php53
).
You have to remove the old PHP and then install PHP 5.3 separately. This sounds similar to your package from the IUS repository, but now it's official.
For more information, see the Red Hat release notes.
Note that this is just out from Red Hat, and there will be a little delay before this is available in CentOS. The RHEL 5.6 update looks relatively minor, though, so I shouldn't expect it to be too long.
Try removing the old versions of the packages before installing the new ones:
yum erase php-cli php-comon
then try your yum install.
Warning: look at the list of changes that yum wants to make before committing, to make sure you are not removing other important packages.
You are correct, you need to uninstall the default php packages first. Before going forward, keep in mind that other packages may have specific dependencies on the base versions. Chances are, you will be fine, but just be forwarned that you may need to address other concerns later.
You should be able to do this by issuing
yum erase php-common php-cli
Followed by your
yum install php53