3
votes

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

3
I think it's either manually compiling or reinstalling php (from yum this time). But I am not sure.andi

3 Answers

2
votes

As a rule of thumb, it's better to have one package management in the system, so you'll be better off packaging everything in RPMS and managing it via yum. It will save you lots of time in the long run.

If you absolutely want to have something (fe PHP) compiler from sources by hand, use stow/checkinstall/... or any other solution which would enable you to do rudimentary package management for source-compiled stuff.

Regerding your question, you could try to override dependency checking by downloading RPM of the required package an doing "rpm -i --force file.rpm", since yum does not have any option for forced installations

4
votes

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 :-)

3
votes

yum doesn't know anything about your hand-compiled php version. You can either bypass RPM's dependency resolution by installing the package using rpm --nodeps and hope it works.

Or install the php version you compiled yourself in another directory so it can coexist with the old version from yum, so everyone is happy (not sure if that's possible, I guess it depends on whether your apps use a hardcoded path to php or not).

Or, if you are lucky, a third-party repository like EPEL or RPMForge might have a newer php package, so you don't have to compile your own.