FreeBSD, PHP and Pecl

Posted by Kevin Way Wed, 28 Feb 2007 02:55:00 GMT

I was helping move a legacy PHP app to a new server, and found it needed a PECL extension (dbx).

After installing PEAR, I got the following error:


[root@machine php]# pecl install something

Fatal error: Call to undefined function preg_match() in /usr/local/share/pear/PEAR/Frontend/CLI.php on line 70

It turns out that the problem is that within FreeBSD’s installation of PECL, it calls PHP from the command line with the -n flag. a.k.a. —no-php-ini

This prevents /usr/local/etc/php/extensions.ini from getting loaded, and thus there is no PCRE support.

You can work around it by removing “-n” from inside the pecl script.