Php – Overriding yum dependency checks when newer versions of the dependent software exist

centosdependenciesPHPyum

I'm using yum on CentOS 5.1 – I hand-compiled PHP 5.2.8 from source, but have other packages installed using yum. I need to install a PHP extension via pecl, and it requires phpize to be installed as well. However, doing the following yields a dependency error:

sudo yum install php-devel

Error: Missing Dependency: php = 5.1.6-20.el5_2.1 is needed by package php-devel

Since I actually have a newer version of PHP already installed, how can I force yum to ignore this? Do I need to hand-compile pecl/phpize from source? I admittedly never had a problem before, it only seems to be because of a combo of compiles and yum installs.

Any thoughts?

Thanks,
Kyle

Best Answer

In general:

If you build it yourself, it goes into /usr/local, and is only accessible to other things in /usr/local.

If you install from RPM/Yum, it goes into /usr, and is accessible to /usr and /usr/local.

So, if you want to install PHP tools using home-compiled PHP, install them into /usr/local as well: typically, with GNU-type software, that'd be something like:

   ./configure --prefix=/usr/local && make && sudo make install

or

   make prefix=/usr/local all && sudo make prefix=/usr/local install

…although most software should default to /usr/local unless you override its prefix setting.

If you want to “hand-build” packages that are based upon RPM's, you can use

   yumdownloader --source WHATEVER-PACKAGE
   rpm -i WHATEVER-PACKAGE.rpm
   rpmbuild -bp ~/rpm/SPECS/WHATEVER-PACKAGE.spec

(your path equivalent to ~/rpm may vary; rpmbuild --showrc will tell you where)

This downloads the .src.rpm package, which contains the upstream (original author's) source (usually a tarball) as well as OS-specific patches; installs the sources into ~/rpm (or your rpmbuild prefix); and then unpacks the sources and applies the patches into ~/rpm/BUILD/WHATEVER-PACKAGE/

From there, you can do the configure/make steps yourself, with the /usr/local prefix

Of course, just installing from RPM's is far easier :-)

Related Topic