FreeBSD pkg_add: warning: package php5-pcre-5.2.6_2 requires php5-5.2.8, but php5-pcre-5.2.6_2 is installed

Q. I’m trying to upgrade my PHP version from 5.2.6 to 5.2.8 using portupgrade command. But I’m getting following errors:

*** Error code 1

Stop in /usr/ports/lang/php5.
*** Error code 1

Stop in /usr/ports/lang/php5.
*** Error code 1

Stop in /usr/ports/lang/php5.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade.42275.0 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-pcre-5.2.6_2 UPGRADE_PORT_VER=5.2.6_2 make reinstall
—> Restoring the old version
pkg_add: warning: package ‘php5-pcre-5.2.6_2’ requires ‘php5-5.2.8’, but ‘php5-pcre-5.2.6_2’ is installed
** Fix the installation problem and try again.
[Updating the pkgdb in /var/db/pkg … – 62 packages found (-0 +1) . done] ** Listing the failed packages (-:ignored / *:skipped / !:failed)
! lang/php5 (php5-pcre-5.2.6_2) (install error)

How do I fix this problem and upgrade php5-pcre?

A. This is well known problem and can be fixed easily.

As of php 5.2.7, pcre extension is distributed with the core php5 package, and not as a standalone module anymore. Follow these steps to update your installation:

# pkg_delete -f php5-pcre-5.2.6
# pkgdb -F
# portupgrade php5-pcre

If you are using portmaster, enter:
# pkg_delete -f php5-pcre*
# portmaster php5*

If you are using pecl ports you might need to force an update on them, enter:
# portupgrade -f pecl*
# portmaster pecl*

If you have the pecl hash, json and/or zip extensions you need to replace them with the php5 bundled ones, enter
# portupgrade -o archivers/php5-zip archivers/pecl-zip
# portupgrade -o devel/php5-json devel/pecl-json
# portupgrade -o security/php5-hash security/pecl-hash

# portmaster -o archivers/php5-zip archivers/pecl-zip
# portmaster -o devel/php5-json devel/pecl-json
# portmaster -o security/php5-hash security/pecl-hash

Finally ,build your INDEX locally and you tried to build it after the php update commit, you need to rebuild it after you updated lang/php5:
# cd /usr/ports
# make index


  1. man page make, portmaster, portupgrade, /usr/ports/UPDATING

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts