php-xml install complains of dependency php-common but this is already installed (CentOS)

Did you try the commands yum asked you to run to fix the situation?

package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest

Try those and after that see if you can install php-xml.

EDIT: Just for kicks, run yum clean all and after that try to reinstall php-xml.


The solution is the accepted answer in:

How to force CentOS yum to use a later version of a package dependency already installed (php-common as a dependency of php-xml)

In summary: move to php5.3.

Reason: support for php5.2 as been removed owing to security issues as explained in that other question's accepted answer. This removal causes mismatch of the versions of the dependencies and therefore the error seen.

Background

I wanted to run Drupal 7 on a CentOS 5.4 machine. So I needed 5.3 version of PHP.

Here are the full working steps to upgrade to PHP 5.3 with working repositories as of May 24 2012 ( I provide comments preceded by # - you don't need these, just for your info)

# Comment: sites like http://www.computingunplugged.com/issues/issue201102/00002619001
# provide a good start for remedying the problem whereby we need 5.3 on CentOS 5.4 to run Drupal 7. But although their packages worked at the time, the links are now outdated, and updates to these are below.


# comment: (as of May 2012 - the following work, the reason for failures was use of 1) older packages no longer on the server and 2) change of address of one of the servers to dl.fedoraproject.org/pub/epel (credit to: http://osdir.com/ml/centos/2012-03/msg00057.html )

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm  

yum erase php php-pear php-mysql php-cli php-common  

yum install php53u php53u-pear php53u-cli php53u-common php53u-gd  
yum install php53u-mbstring php53u-mcrypt php53u-mysql php53u-soap  
yum install php53u-xml php53u-xmlrpc php53u-bcmath 


# After doing the above, php -v shows 5.3.x But on attempting to install Drupal 7 you may get complaint of something "Your PHP installation is too old 5.1.6 Drupal requires at least PHP 5.2.4. See the system requirements page for more information." and php.info shows the same

# The remedy is to simply restart your apache server

service httpd restart

# credit to following for suggesting service httpd restart :-
# https://serverfault.com/a/207806/29205
# https://serverfault.com/questions/207762/centos-updating-php-via-yum-doesnt-change-the-version-apache-uses

# Drupal 7 install on CentOS 5.4 worked after applying the above steps

# If your MySQL server is not running (check by ps -ef | grep mysql ) then you can run:

/etc/init.d/mysqld

# ...to start it, and to make sure it starts when the machine is restarted or cold booted:

chkconfig mysqld on