PHP 5.4 after installation: preg_match (): Compilation error: unknown option bit set at offset 0

I recently updated my PHP to version 5.4.1 on my Lion OS X 64bit, I get an error 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 ran into a problem, this seems to be a problem with PCRE lib in PHP, and I followed this tutorial which shows how to install pcre with homebrew, which I did (I am running pcre 8.30) and this did not solve the problem.

I tried looking for solutions, but I did not come across the one that helped - is there a way to fix this problem with PCRE lib?

EDIT: just edited this question to remind me that my setup is:

 ./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 
+6
source share
4 answers

I managed to get PHP 5.4.1 working with PCRE version 8.12 (this is the version included in PHP 5.4.1, I think). After all the comments and comments listed in the comments on the question, I decided to compile PHP without the PCRE flags and let PHP just use it by default. Using the default values, it compiles with 8.12.

Now, the next questions, of course, WHY this happens. I would still expect 8.30 to be compiled with PHP with the flags I provided. But for now, I'm just happy that everything works.

Below are the configuration options that I got to work if you want to try this 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 
+6
source

I solved this problem by updating PHP and PCRE on my Linux machine using yum update .

PHP was upgraded to version 5.3.17, and PCRE was upgraded to version 8.21-5.3amzn1 (I am running an instance of Amazon EC2).

+3
source

My solution was next to what @bigZero was offering.

I could not get it to work with brew because when I tried to install pcre v8.12 on brew it was not possible because it was (possibly) removed from the repository. I mean this is shown on brew versions pcre , but when I tried to install it, it could not load from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

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

I tried to recompile php (in my case 5.4.10) without the option --with-pcre-regex (as suggested by @ scott-harwell, but this did not work when compiling. Then I added --with-pcre-regex=/usr/ and finally worked.

0
source

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

-1
source

Source: https://habr.com/ru/post/914248/


All Articles