登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

永福的技术博客

Linux运维

 
 
 
 
 

日志

 
 

freebsd Fatal error: Call to undefined function preg_match()  

2010-11-30 16:43:40|  分类: FreeBSD |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
搜索到的四种问题描述和解决:

经常有兄弟遇到这个问题,装了apache+mysql+php,很高兴的去用bbs什么的,发现不能运行,而phpinfo函数显示的是正常的,现把问题解决方案贴出来,以备大家查询。 
1、原因:安装php的时候没有加入PERL_REGEXT的支持,也就是所谓的perl兼容正则表达式 
2、首先确保您的php是以mod_php来安装的。 
cd /usr/ports/www/mod_php4 make install clean;
3、还需要安装php4-extensions 
cd /usr/ports/lang/php4-extensions/ make install clean; 

pecl Fatal error: Call to undefined function preg_match() 处理办法 收藏
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 拿掉吧….

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


On Tue, 2006-03-07 at 16:43 +0100, Olivier Mueller wrote: > $ pecl > Fatal error: Call to undefined function preg_match() > in /usr/local/share/pear/PEAR/Frontend/CLI.php on line 70 >  > But the preg functions are installed and active. (pcre.so & co.)  update:  pecl can't work this way because at the end of /usr/local/bin/pecl, php is started with option "-n" :      -n               No php.ini file will be used  ( exec $PHP -C -n -q $INCARG -d output_buffering=1 -d safe_mode=0 $INCDIR/peclcmd.php "$@" ).  And with php5-5.1.2_1, the extensions are not compiled in the php binary, but defined in php.in...  By remove this "-n", pecl is working fine...  > Well, I'd still like to get my pecl pop3 running... An idea?   The pecl part is ok, but the pop3 won't compile (yet):  gcc -I. -I/usr/local/src/pop3-1.0.2 -DPHP_ATOM_INC -I/usr/local/src/pop3-1.0.2/include -I/usr/local/src/pop3-1.0.2/main -I/usr/local/src/pop3-1.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/pop3-1.0.2/pop3.c  -fPIC -DPIC -o .libs/pop3.o /usr/local/src/pop3-1.0.2/pop3.c: In function `pop3_objects_new': /usr/local/src/pop3-1.0.2/pop3.c:175: error: structure has no member named `in_get' /usr/local/src/pop3-1.0.2/pop3.c:176: error: structure has no member named `in_set' *** Error code 1  work in progress... :) regards, Olivier
描述及解决四:http://www.michiknows.com/2007/02/27/fatal-error-call-to-undefined-function-preg_match/

Today’s crazy error of the day is:

Fatal error: Call to undefined function preg_match() …

Wahoo! A built in function being undefined!

So how’s this possible? It seems that if you reinstall PHP without compiling in PCRE (Perl Compatible Regular Expressions), you can get this crazy error. It’s a flag you may need to manually enable.

  • cd /usr/ports/devel/php5-pcre
    make deinstall rmconfig clean
    make build
    make install
    make clean
    apachectl graceful
  • @Till,

    Thanks for this post! I tried my best to get my FreeBSD server running after updating to PHP 5.2.10

    I would just recommend adding the following step in to ensure you start from scratch:

    make rmconfig - will remove your old user config settings.

    So the steps will be:

    cd /usr/ports/devel/php5-pcre
    make deinstall rmconfig clean
    make build
    make install
    make clean
    apachectl graceful

    Last line is a more graceful way of restarting Apache.
  • Thanks a zillion I was going nutz. I was also have trouble with some pages with php just showing blank pages. 

    I was on freebsd 7.0 and also had just done a portupgrade of a bunch of packages so I had no idea where to start looking. rebuilding /devel/php5-pcre did the trick.

    Thanks again for posting.
  • David 1 year ago
    Till,

    Much appreciate this post...been trying fix PCRE on my FreeBSD 7 box for about 3 hours now. Thanks for the info, got my phpMyAdmin and Gallery setup working again.

    cd /usr/ports/devel/php5-pcre
    make deinstall clean
    make build
    make install
    /usr/local/etc/rc.d/apache22 restart


    Hi.  Thanks for the suggestion:  > It looks like your module versions are out of date.  Try to recompile > apache and all your php extensions.  I tried to accomplish this by doing: cd /usr/ports/lang/php5 make deinstall cd /usr/ports/lang/php5-extensions make deinstall cd /usr/ports/www/apache2 make deinstall make reinstall cd /usr/ports/lang/php5 make reinstall cd /usr/ports/lang/php5-extensions make reinstall  This didn't seem to change anything.  I also tried installing /usr/ports/www/mod_php5 but that seemed to conflict with the php5 installation.  Am I doing this right?  Any other suggestions?  Thanks  Quoting Anish Mistry <mistry.7 at osu.edu>:  > On Wednesday 20 April 2005 11:07 pm, Stephen Kelly wrote: > > Hi All, > > > > I'm using freebsd 5.3, apache2, and php5.  I was getting the > > following error from one of my php scripts: > > > > Fatal error: Call to undefined function preg_match() > > > > So, after looking around on various lists, I determined that I > > needed to install php5-pcre, so I installed the ports > > /usr/port/devel/pcre, and /usr/ports/devel/php5-pcre. > > > > But now I get the following error in my /var/log/httpd-error.log > > file: > > > > PHP Warning:  PHP Startup: pcre: Unable to initialize module > > Module compiled with module API=20040412, debug=1, thread-safety=0 > > PHP    compiled with module API=20041030, debug=1, thread-safety=0 > > These options need to match in Unknown on line 0 > > > > It looks like your module versions are out of date.  Try to recompile > apache and all your php extensions. > > > Can anyone tell me how to solve this problem? > > I also tried installing /usr/ports/lang/php5-extensions but I got > > similar errors for many of the extensions.  I have also recently > > upgraded my ports collection with cvsup.  I've been frigging around > > deinstalling and reinstalling things but I can't find the actual > > problem. > > > > Any help is greatly appreciated. > > Thanks, > > Stephen > > _______________________________________________ > > freebsd-questions at freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to > > "freebsd-questions-unsubscribe at freebsd.org" > > -- > Anish Mistry >
  评论这张
 
阅读(2156)| 评论(1)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018