PHP 5.4后安装:的preg_match():编译失败:设置为未知选项位(S)偏移0(PHP 5

2019-06-24 00:23发布

我最近升级我的PHP 5.4.1版本在我的狮子OS X 64位,我越来越笨中抛出一个错误:

Severity: Warning

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

Filename: core/Utf8.php

Line Number: 44

我用Google搜索的问题,这似乎是在PHP中的PCRE LIB问题,以及我跟着这个教程这说明了安装与自制,我做到了(我PCRE 8.30运行),这并没有解决问题PCRE。

我试着四处寻找解决办法,但我还没有碰到过一个帮助来 - 有没有解决这个PCRE LIB问题的方法?

编辑:只是编辑这个问题,提醒我什么我安装的是:

./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

Answer 1:

我能得到PHP 5.4.1与PCRE版本8.12的工作(这是在PHP 5.4.1,我相信包括版本)。 毕竟来回在问题的意见上市,我决定编译PHP没有PCRE标志,让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


Answer 2:

我用我的Linux机器上更新PHP和PCRE解决这个问题yum update

PHP已更新至5.3.17版本,PCRE更新为8.21-5.3amzn1版本(我在Amazon EC2实例中运行)。



Answer 3:

我的解决办法接近@bigZero什么建议。

我不能让它BREW的工作,因为当我试图在酿造安装PCRE v8.12,因为它是(也许)从资源库中删除是不可能的。 我的意思是,它是在显示brew versions pcre ,但是当我试图安装它无法从下载ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

因此,我不得不从下载PCRE 8.12源代码http://www.pcre.org ,编译并安装它。 我用下面的配置: ./configure --prefix=/usr --enable-utf8 --enable-unicode-properties

我试图不重新编译PHP(在我的情况5.4.10) --with-pcre-regex的选项(如@斯科特-哈威尔建议,但在编译时失败了。比我加入--with-pcre-regex=/usr/它终于奏效。



Answer 4:

重新编译的httpd。 在此之前,确保你只有一个你的系统版本PCRE的。



文章来源: PHP 5.4 after-install: preg_match(): Compilation failed: unknown option bit(s) set at offset 0