0

For reasons that I cannot control, I am being forced to roll my own rpms for PHP under CentOS 7.4. I have built rpms for php 7.2.5 and installed them in a local repository. yum install php picks up the local version and the package is installed under /usr/local. My problem is with php-pear. For some reason, yum wants to pick up the stock version of php-pear instead of my version, even though my version has the higher version number.

# yum --showduplicates list php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
php-pear.noarch    1.10.5-1.el7.centos    nci-f
php-pear.noarch    1:1.9.4-21.el7         base
php-pear.noarch    1:1.9.4-21.el7         base
php-pear.noarch    1:1.9.4-21.el7         base
# yum install php-pear
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package php-pear.noarch 1:1.9.4-21.el7 will be installed
--> Processing Dependency: php-bz2 for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-tokenizer for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-xml for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-cli for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-zlib for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-ftp for package: 1:php-pear-1.9.4-21.el7.noarch
--> Processing Dependency: php-pcre for package: 1:php-pear-1.9.4-21.el7.noarch
--> Running transaction check
 ...

I have set the priority of the nci-f repository to 1 with no effect. I know that I can use yum install php-pear-7.2.5-1.el7.centos to install the specific package but both want to use the simpler command (on 400+ servers) and want to make sure updates work in the future.

Also, in my .spec file for the php-pear package I do have the line

Obsoletes: php-pear  <= 1:1.9.4

Why is yum picking the lower version package and how can I get it to prefer my package instead?

1

See the epoch (the 1 in 1:1.9.4-21), it overrides your (default) epoch 0 packages.

The epoch was introduced in rpm packages precisely to be able to "fix" version numbers that go backwards. Use with extreme caution.

Besides, the RHEL/Centos packages probably include lots of local fixes/tweaks. I'd suggest you start with the official source packages and tweak those, replacing the sources with newer versions as needed.

  • The official source packages are for php 5.4 - that's a lot of tweaking to bring them up to php 7.2. – doneal24 May 17 '18 at 17:35

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.