How To Fix php5-pcre Ignored Package in FreeBSD Ports

I guess most of the FreeBSD users having problem to patch php5-pcre package in FreeBSD Ports. Whenever you run portversion -vL=, you will always see php5-pcre is outdated even after running portupgrade php5-pcre, you will get the error message;


pkg_add: warning: package 'php5-pcre-5.2.6_2' requires 'php5-5.2.8', but 'php5-pcre-5.2.6_2' is installed
--->  Removing old package'
** Fix the installation problem and try again.
--->  Installation of lang/php5 ended at: Thu, 12 Feb 2009 10:39:18 +0800 (consumed 00:00:02)
--->  Upgrade of lang/php5 ended at: Thu, 12 Feb 2009 10:39:18 +0800 (consumed 00:03:12)
--->  ** Upgrade tasks 1: 0 done, 0 ignored, 0 skipped and 1 failed
[Updating the pkgdb  in /var/db/pkg ... - 198 packages found (-0 +1) . done]
--->  Listing the results (+:done / -:ignored / *:skipped / !:failed)
        ! lang/php5 (php5-pcre-5.2.6_2) (install error)
--->  Packages processed: 0 done, 0 ignored, 0 skipped and 1 failed
--->  Session ended at: Thu, 12 Feb 2009 10:39:21 +0800 (consumed 00:03:16)

Since php5-5.2.8, PCRE is built in php5 package, to get rid of php5-pcre package, delete the package and fix the ports database;

Check current installed php5-pcre package;


pkg_info | grep pcre
php5-pcre-5.2.6_2   The pcre shared extension for php

Delete php5-pcre package


pkg_delete -f php5-pcre-5.2.6_2
pkg_delete php5-pcre-5.2.6_2
pkg_delete: package 'php5-pcre-5.2.6_2' is required by these other packages
and may not be deinstalled:
php5-bz2-5.2.8
php5-ctype-5.2.8
php5-gd-5.2.8_1
php5-mysql-5.2.8
php5-session-5.2.8

Fix package dependencies on php4-pcre


pkgdb -F
--->  Checking the package registry database
Duplicated origin: lang/php5 - php5-5.2.8 php5-pcre-5.2.6_2
Unregister any of them? [no] yes
  Unregister php5-5.2.8 keeping the installed files intact? [no] 
  Unregister php5-pcre-5.2.6_2 keeping the installed files intact? [no] yes
  --> Saving the php5-pcre-5.2.6_2's +CONTENTS file as /var/db/pkg/php5-5.2.8/+CONTENTS.php5-pcre-5.2.6_2
  --> Unregistering php5-pcre-5.2.6_2
  --> Done.
[Updating the pkgdb  in /var/db/pkg ... - 197 packages found (-1 +0) (...) done]
Stale dependency: php5-bz2-5.2.8 -> php5-pcre-5.2.6_2 (lang/php5):
Fixed. (-> php5-5.2.8)
Stale dependency: php5-ctype-5.2.8 -> php5-pcre-5.2.6_2 (lang/php5):
Fixed. (-> php5-5.2.8)
Stale dependency: php5-gd-5.2.8_1 -> php5-pcre-5.2.6_2 (lang/php5):
Fixed. (-> php5-5.2.8)
Stale dependency: php5-mysql-5.2.8 -> php5-pcre-5.2.6_2 (lang/php5):
Fixed. (-> php5-5.2.8)
Stale dependency: php5-session-5.2.8 -> php5-pcre-5.2.6_2 (lang/php5):
Fixed. (-> php5-5.2.8)

The fixed solution is provide in /usr/ports/UPDATING file.