2012-04-05 69 views
6

大家好! FreeBSD noobie寻找一些帮助,用mod_php集成PCRE和Apache。PCRE编译时没有UTF支持

我有什么:

  • 的FreeBSD 8.2-RELEASE-P3
  • 的Apache/2.2.22(FreeBSD的,从港口建)
  • PHP 5.3.10用了Suhosin贴片(CLI)(建:2012年4月6日2时58分27秒)(而不是从端口)
  • PCRE版本8.30 2012-02-04

    Compiled with 
        8-bit support only 
        UTF-8 support 
        Unicode properties support 
        No just-in-time compiler support 
        Newline sequence is LF 
        \R matches all Unicode newlines 
        Internal link size = 2 
        POSIX malloc threshold = 10 
        Default match limit = 10000000 
        Default recursion depth limit = 10000000 
        Match recursion uses stack 
    

php -i | grep -i pcre告诉我,他用下面PCRE的版本:

Configure Command => './configure' '--with-layout=GNU' 
         '--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php' 
         '--disable-all' '--enable-libxml' '--enable-mysqlnd' 
         '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local/lib' 
         '--with-zlib-dir=/usr' '--program-prefix=' '--with-apxs2=/usr/local/sbin/apxs' 
         '--with-regex=php' '--with-zend-vm=CALL' 
         '--enable-zend-multibyte' '--prefix=/usr/local' 
         '--mandir=/usr/local/man' '--infodir=/usr/local/info/' 
         '--build=i386-portbld-freebsd8.2' 
pcre 
PCRE (Perl Compatible Regular Expressions) Support => enabled 
PCRE Library Version => 8.30 2012-02-04 
pcre.backtrack_limit => 1000000 => 1000000 
pcre.recursion_limit => 100000 => 100000 

,一切工作正常,当我尝试运行命令行我的PHP应用程序,以这样的方式php < somecode.php

但是当我通过Apache执行它,我收到此错误:Compilation failed: this version of PCRE is compiled without UTF support at offset 0

我试图从港口重建阿帕奇与--with-pcre=/usr/local/bin,但它与消息阿帕奇找不到PCRE-config脚本失败。

什么可能是错误的?

+0

看一看[这个答案](http://stackoverflow.com/a/2107027/198536)一个非常类似的问题。 – wallyk 2012-04-06 07:00:16

+0

@wallyk,谢谢!但这不是我的变体。我已经使用utf和unicode支持重新编译PCRE,并且它可以在cli模式下正常工作。我的问题是在Apache的pcre模块,如果我理解正确。 – RomiC 2012-04-06 08:43:31

+1

您是否检查过apache上的php与命令行中的php相同?也许你有第二个版本。另外检查一下,也许有两个版本的pcre安装。 – arved 2012-04-06 09:06:06

回答

4

解决的问题刚刚重建Apache与系统pcre而不是默认值。要做同样的事情,建立你的Apache的--with-pcre选项,它应该包含pcre-config的完整路径,包括pcre-config本身。在我的情况下,它是--with-pcre=/usr/local/bin/pcre-config

感谢所有)

+0

感谢您的跟进! – wallyk 2012-04-11 20:50:38