Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
418 views
in Technique[技术] by (71.8m points)

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

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(): Compilation failed: unknown option bit(s) set at offset 0

Filename: core/Utf8.php

Line Number: 44

I Googled the problem, this seems to be a problem with the PCRE lib in PHP, well I followed this tutorial which shows to install pcre with homebrew which I did (I'm running pcre 8.30) and this didn't solve the problem.

I've tried looking around for solutions, but I haven't came across one that helped - is there a method of fixing this PCRE lib problem?

EDIT: Just edited this question to remind me what my installation was:

./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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...