zoukankan      html  css  js  c++  java
  • pcre 不支持 utf 的问题

    问题
    Error 500 
    preg_match(): Compilation failed: this version of PCRE is compiled without UTF support at offset 0
     
     
    具体分析
    环境:centos7,lnmp,nginx和php-fpm都是yum安装的,pcre已经安装
     
    开始以为是nginx编译的问题,重新编译,不行。
     
    最后发现是pcre编译有问题,pcre7.9以上的版本,默认是不支持Unicode、UTF-8的,要重新编译手动指定 --enable-utf8
     
     
    解决方法

    PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括perl兼容的正则表达式库。这些在执行正则表达式模式匹配时用与Perl 5同样的语法和语义是很有用的,也可以来解决C语言中使用正则表达式的问题。

    PCRE下载地址:https://sourceforge.net/projects/pcre/files/pcre/

     

    重新编译安装pcre: 

    1、下载pcre-8.38.tar.gz

    2、解压

    # tar zxvf pcre-8.38.tar.gz
    # cd pcre-8.38

    3、编译安装(指定:--enable-utf8 --enable-unicode-properties ) 

    # ./configure --enable-utf8 --enable-unicode-properties
    # make
    # make install

     

    当安装好pcre后,利用pcretest命令来打印pcre的安装情况,一般输出如下:

    # pcretest -C
    PCRE version 8.38 2015-11-23
    Compiled with
      8-bit support
      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
      Parentheses nest limit = 250
      Default match limit = 10000000
      Default recursion depth limit = 10000000
      Match recursion uses stack

     

    参考:http://www.cnblogs.com/pcat/p/5520317.html

     

     
  • 相关阅读:
    RocketMQ 概念
    CentOS7使用firewalld管理防火墙
    java应用启动报错Unable to access jarfile xxxxx.jar
    docker启动redis并设置密码
    sql优化整理(二)
    sql优化整理(一)
    dubbo配置的覆盖关系
    dubbo配置加载优先级
    ZooKeeper的数据模型
    leetcode104:permutations
  • 原文地址:https://www.cnblogs.com/hjqjk/p/5552890.html
Copyright © 2011-2022 走看看