PHP 5.4 安装后 : preg_match(): Compilation failed: unknown option bit(s) set at offset 0

标签 php codeigniter pcre

我最近在我的 Lion OS X 64 位上将我的 PHP 升级到版本 5.4.1,我在 Codeigniter 中遇到了一个错误:

Severity: Warning

Message: preg_match(): Compilation failed: unknown option bit(s) set at offset 0

Filename: core/Utf8.php

Line Number: 44

我用谷歌搜索了这个问题,这似乎是 PHP 中的 PCRE 库的问题,我遵循了 this tutorial这表明我用自制软件安装了 pcre(我正在运行 pcre 8.30),但这并没有解决问题。

我尝试四处寻找解决方案,但没有找到有用的解决方案 - 是否有解决此 PCRE 库问题的方法?

编辑:刚刚编辑了这个问题以提醒我我的安装是什么:

./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--with-freetype-dir=/usr/X11/ \
--with-jpeg-dir=/usr \
--with-png-dir=/usr/X11/ \
--enable-gd-native-ttf \
--with-icu-dir=/usr \
--with-iodbc=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pgsql=/usr \
--with-pdo-pgsql=/usr \
--with-mcrypt=/usr/local/lib

最佳答案

我能够让 PHP 5.4.1 与 PCRE 版本 8.12(我相信这是包含在 PHP 5.4.1 中的版本)一起工作。在问题的评论中列出所有来回之后,我决定在没有 PCRE 标志的情况下编译 PHP,让 PHP 只使用它的默认值。通过使用默认值,它可以使用 8.12 进行编译。

现在,后续问题当然是为什么会发生这种情况。我仍然希望 8.30 能够使用我提供的标志使用 PHP 进行编译。但是,在这一点上,我很高兴它能正常工作。

以下是我必须使用的配置选项,以防您想从头开始尝试。

./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--with-freetype-dir=/usr/X11/ \
--with-jpeg-dir=/usr \
--with-png-dir=/usr/X11/ \
--enable-gd-native-ttf \
--with-icu-dir=/usr \
--with-iodbc=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-pgsql=/usr \
--with-pdo-pgsql=/usr \
--with-mcrypt=/usr

关于PHP 5.4 安装后 : preg_match(): Compilation failed: unknown option bit(s) set at offset 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10338234/

相关文章:

javascript - 动态添加文本框输入将作为一个保存到数据库中

PHP 将数组赋值给变量

php - 当 Controller 类扩展父 Controller 时,为什么我们仍然需要父构造函数?

codeigniter - 在数组中加载多个模型 - codeigniter 框架

匹配 1 次或 2 次出现的正则表达式

php - 在带有转义的 php 中用逗号和等号分隔字符串

php - 如何在不使用php中的移动上传或复制功能的情况下将图像保存并显示到数据库中

php - 我的php和Mysql程序有问题吗?

MySQL - 如何找到值变化最大的行?

c - c程序中如何使用pcre库匹配url