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

后端 未结 4 446
余生分开走
余生分开走 2020-12-16 05:20

I recently upgraded my PHP to version 5.4.1 on my Lion OS X 64bit, I\'m getting an error thrown in Codeigniter:

Severity: Warning

Message: preg_match(): Com         


        
相关标签:
4条回答
  • 2020-12-16 06:16

    My Solution was near to what @bigZero proposed.

    I couldn't make it work on brew because when I tried to install pcre v8.12 on brew it was not possible because it was (maybe) erased from the repository. I mean, it is shown on brew versions pcre but when I tried to install it failed to download from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

    So I had to download the pcre 8.12 source code from http://www.pcre.org, compile it and install it. I used the following configure: ./configure --prefix=/usr --enable-utf8 --enable-unicode-properties

    I tried to recompile php (in my case 5.4.10) without the --with-pcre-regex option (as suggested by @scott-harwell. But it failed while compiling. Than I added --with-pcre-regex=/usr/ and it finally worked.

    0 讨论(0)
  • 2020-12-16 06:18

    Recompile httpd. Before that make sure you have only one version of pcre on your system.

    0 讨论(0)
  • 2020-12-16 06:22

    I resolved this issue by updating PHP and PCRE on my Linux machine using yum update.

    PHP was updated to version 5.3.17 and PCRE was updated to version 8.21-5.3amzn1 ( I'm running on an Amazon EC2 instance ).

    0 讨论(0)
  • 2020-12-16 06:23

    I was able to get PHP 5.4.1 working with PCRE version 8.12 (which is the version included in PHP 5.4.1 I believe). After all the back and forth listed in the question's comments, I decided to compile PHP without the PCRE flags and let PHP just use it's defaults. By using the defaults, it compiles with 8.12.

    Now, a follow up questions is, of course, WHY this happens. I would still expect 8.30 to be compiled with PHP with the flags I provided. But, at this point, I am just happy to have the thing working.

    Below are the config options I got to work in case you want to try it from your end.

    ./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
    
    0 讨论(0)
提交回复
热议问题