For a while I’ve had sporadic problems with pecl (PHP’s binary module building tool, part of PEAR) not working properly. Usually the error was:
[root@host ~]# pecl install memcache
Fatal error: Call to undefined function preg_match() in /usr/local/share/pear/PEAR/Frontend/CLI.php on line 70
Yet, preg_match() would work from other scripts - it is part of pcre, which was installed.
The problem is this. pcre is included via extensions.ini. That’s why it usually works. However, pecl for some reason deliberately turns off .ini file inclusion (that includes extensions.ini) when it runs the php interpreter. I’m not sure what the objective was here but it’s a problem on FreeBSD’s shared library pcre.so.
The fix: edit the pecl script (usually /usr/local/bin/pecl) and remove the ‘-n’ from the command line arguments.