---
title: "pecl Fatal error: Call to undefined function preg_match()  处理办法"
author: "wewi"
date: "2007-08-21T22:23:00Z"
tags: []
slug: "pecl-fatal-error-call-to-undefined-function-preg-match"
draft: false
lastmod: "2007-08-21T22:23:00Z"
id: 466130
url: "https://wewi.iteye.com/blog/466130"
---

[http://blog.urdada.net/2006/07/25/15/](http://blog.urdada.net/2006/07/25/15/)

我發現直接執行 pecl 會發生錯誤（至少在 FreeBSD 下是如此）：

```
# pecl
Fatal error: Call to undefined function preg_match() in ...
```

問題出在 /usr/local/bin/pecl 這個 script 的最後一行：

```
exec $PHP -C -n -q $INCARG -d output_buffering=1 -d safe_mode=0 ...
```

這一行的 -n 這個選項代表不載入 php.ini 設定檔，因此 pcre.so 就沒有被載入，  
然後你就看到上面的錯誤了，所以自己去改一下程式把 -n 拿掉吧….

拿掉之後，安裝程式應該就可以正常運作了了：