Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

PHP/pcre problem - internal pcre_fullinfo() error -3

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
35 posts
  • 1
  • 2
  • Next
Author
Message
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

PHP/pcre problem - internal pcre_fullinfo() error -3

  • Quote

Post by hanj » Sat Jan 03, 2009 3:18 pm

I'm seeing the following errors in the logs when using preg_match() or preg_replace() on one of my development servers

Code: Select all

PHP Warning:  preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Internal pcre_fullinfo() error -3
My simple PHP code test to reproduce this is as follows..

Code: Select all

<?
$str = 'test';
 function test($str) {
    return =  preg_replace("/([\"\\\\])/", "\\\\$1", $str);
}
echo test($str);
?>
This occurred when I updated PHP to 5.2.8-r1. Rolling it back to 5.2.6-r7 works. I've never had a problem with pcre in the past with this server. This server seems to be the only server I manage that is affected. Also, when executing my test script as a PHP-CLI script it does NOT error???

Here are my USE flags for libpcre and php.

Code: Select all

[ebuild   R   ] dev-libs/libpcre-7.8  USE="bzip2 cxx unicode zlib -doc" 0 kB
[ebuild   R   ] dev-lang/php-5.2.8-r1  USE="apache2 berkdb cli crypt gdbm iconv mysql mysqli ncurses nls pcre readline reflection session spl ssl truetype unicode xml zlib -adabas -bcmath -birdstep -bzip2 -calendar -cdb -cgi -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hash -imap -inifile -interbase -iodbc -ipv6 (-java-external) -json -kerberos -kolab -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -snmp -soap -sockets -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip -zip-external" 0 kB
I also verified that --with-pcre-regex=/usr was included within the configure on the compile. I posted on a related thread here: http://forums.gentoo.org/viewtopic-t-49 ... -pcre.html, but wanted to break out a new thread thinking the [SOLVED] was not getting looks.

Any help is greatly appreciated.

Thanks much!
hanji
Server Admin Blog - Uno-Code.com
Top
makenoob
Apprentice
Apprentice
Posts: 272
Joined: Thu Aug 19, 2004 9:03 pm
Location: /Germany/Düsseldorf

  • Quote

Post by makenoob » Mon Jan 05, 2009 3:09 pm

same problem over here. this also affects phpmyadmin. phpmyadmin will not detect the correct version of php, spams the error_log with errors and shows empty mysql tables.

any ideas, anyone?
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Mon Jan 05, 2009 3:13 pm

Whoa... glad (sorta) that I'm not the only one. Can you test a CLI script to see if that works?

Thanks!
hanji
Server Admin Blog - Uno-Code.com
Top
makenoob
Apprentice
Apprentice
Posts: 272
Joined: Thu Aug 19, 2004 9:03 pm
Location: /Germany/Düsseldorf

  • Quote

Post by makenoob » Mon Jan 05, 2009 3:20 pm

sorry hanji,

but as this is a production machine and i rolled back php to 5.2.6-r7, too, i cannot test it. maybe someone else can verify this.
Top
j4miel
n00b
n00b
Posts: 58
Joined: Mon Sep 26, 2005 5:41 pm

  • Quote

Post by j4miel » Tue Jan 06, 2009 11:18 am

Working for me on a clean emerge of libpcre (Same use flags) and php-5.2.8-r1. Tested on cli and cgi.
Top
hoffie
Retired Dev
Retired Dev
Posts: 24
Joined: Thu Nov 30, 2006 5:25 pm

  • Quote

Post by hoffie » Tue Jan 06, 2009 10:04 pm

I guess all of you are using mod_php, right?

As you already noticed, old Gentoo php versions used to use the system version of libpcre, newer versions (including all versions of 5.2.6) no longer did (i.e. they used the bundled library, which is shipped with php). This switch (usually against Gentoo packaging policy) was done because of problems, sadly noone was able to remember any of those. Recent versions of php (>=5.2.7) again use the system copy of libpcre, for security and maintainance reasons, but also, because using <php-5.2.7 with apache/mod_php and recent versions of libpcre made PHP unusuable as well.

So, sucky situation now. Neither internal nor external works properly, and that's why I'm targetting fixing the external support. I'll look into it in the next few days, but I can't promise anything. I doubt I can reproduce it (phpmyadmin is testing of my does-this-php-version-work process, both fastcgi and mod_php, and it worked, when I tried), but I'll try the reproduce script.
Top
makenoob
Apprentice
Apprentice
Posts: 272
Joined: Thu Aug 19, 2004 9:03 pm
Location: /Germany/Düsseldorf

  • Quote

Post by makenoob » Wed Jan 07, 2009 8:51 am

hoffie wrote:I guess all of you are using mod_php, right?
yes, i am using mod_php. i also tried to recompile libpcre after installing php-5.2.8-r1, but it didn't solve my problem.

thanks for your work, hoffie. i hope, you can iron this out.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Sat Jan 10, 2009 11:57 pm

Hello hoffie

I'm am using mod_php (70_mod_php5.conf -- libphp5.so). Any more information on the problem? Very weird how this is only a issue on a single box I'm managing, all the others seem to work fine?

Thanks for the help!
hanji
Server Admin Blog - Uno-Code.com
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Mon Jan 12, 2009 4:38 pm

Hello

Any progress or additional thoughts/ideas on this issue?

Thanks!
hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Mon Jan 12, 2009 4:49 pm

To me, it looks like there's a static copy of libpcre that's hiding out somewhere causing a symbol collision. Is all of your web stack ~arch? Which other modules are installed? The more information we have to guess from the better.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Mon Jan 12, 2009 5:18 pm

Here are my -D flags for apache on that box...

Code: Select all

APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"
ColdFusion is running on that server as well, and that is managed via the init script.

Here is what I have for pcre in /usr/lib

Code: Select all

-rw-r--r--   1 root root  213900 Dec 30 19:01 libpcre.a
-rw-r--r--   1 root root     796 Dec 30 19:01 libpcre.la
lrwxrwxrwx   1 root root      16 Dec 30 19:01 libpcre.so -> libpcre.so.0.0.1
lrwxrwxrwx   1 root root      16 Dec 30 19:01 libpcre.so.0 -> libpcre.so.0.0.1
-rwxr-xr-x   1 root root  193760 Dec 30 19:01 libpcre.so.0.0.1
-rw-r--r--   1 root root   38740 Dec 30 19:01 libpcrecpp.a
-rw-r--r--   1 root root     945 Dec 30 19:01 libpcrecpp.la
lrwxrwxrwx   1 root root      19 Dec 30 19:01 libpcrecpp.so -> libpcrecpp.so.0.0.0
lrwxrwxrwx   1 root root      19 Dec 30 19:01 libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
-rwxr-xr-x   1 root root   34272 Dec 30 19:01 libpcrecpp.so.0.0.0
-rw-r--r--   1 root root    3474 Dec 30 19:01 libpcreposix.a
-rw-r--r--   1 root root     851 Dec 30 19:01 libpcreposix.la
lrwxrwxrwx   1 root root      21 Dec 30 19:01 libpcreposix.so -> libpcreposix.so.0.0.0
lrwxrwxrwx   1 root root      21 Dec 30 19:01 libpcreposix.so.0 -> libpcreposix.so.0.0.0
-rwxr-xr-x   1 root root    9424 Dec 30 19:01 libpcreposix.so.0.0.0
Is there anyway to track down the possible static copy? Doing a `slocate libpcre`, it only finds them in /usr/lib which I listed above.

I'm not sure if I'm following the ~arch question on the web stack.

Thanks for the reply!
hanji
Server Admin Blog - Uno-Code.com
Top
buzzin
Apprentice
Apprentice
User avatar
Posts: 264
Joined: Fri Oct 17, 2003 4:42 am
Location: St. Albans, UK.

  • Quote

Post by buzzin » Wed Jan 14, 2009 2:53 pm

Ive hit the same problem with just one of my servers.. Others seems to be running php-5.2.8-r1 fine.. Luckily it was the dev server which it happened too so i can muck about and see if i can find any workaround.

Using mod_php
No cold fusion here
CLI seems unaffected.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 4:56 pm

Is there any way to determine what PHP is using for libpcre?

hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Tue Jan 20, 2009 9:47 pm

Code: Select all

ldd /usr/bin/php|grep pcre
That will only give you the library it thinks it's using. The problem is that there probably exists another copy somewhere on your system which is loaded in the same address space. Then symbol collision happens and boom.
I know [bug=254659]glib is using its own copy of libpcre[/bug], so if you have dev-libs/glib installed, you could try this, although it's at best a long-shot.
First, dev-libs/libpcre must be installed with unicode support, so:

Code: Select all

echo "dev-libs/libpcre unicode" >> /etc/portage/package.use
emerge -1 dev-libs/libpcre
EXTRA_ECONF="--with-pcre=system" emerge -1 dev-libs/glib:2
That will at least rid you of one copy of libpcre.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 9:58 pm

loki_val wrote:

Code: Select all

ldd /usr/bin/php|grep pcre
I ran that.. and was surprised to see nothing returned?? My other servers returned libpcre.so.0.

eix libpcre shows...

Code: Select all

[I] dev-libs/libpcre
     Available versions:  (3)  7.7-r1 7.8
I'm confused???

hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Tue Jan 20, 2009 10:33 pm

:idea: Ok, now we're getting somewhere. :idea: First, I can't see the installed version. We now know that for some reason libpcre is not getting linked to your php. If you have not already done so, try emerging php-5.2.8-r2 and libpcre-7.8
Then, if

Code: Select all

ldd /usr/bin/php|grep pcre
still returns nothing, I'd like you to try running this command:

Code: Select all

ebuild /usr/portage/dev-lang/php/php-5.2.8-r2.ebuild clean compile
Then, I need you to open a bug on bugs.gentoo.org with this subject:
dev-lang/php-5.2.8-r2 fails to link to system libpcre, causing segfaults

In the comment box, put a link to this thread with a short explanation and post the output of:

Code: Select all

emerge -pv dev-libs/libpcre dev-lang/php
ldd /usr/bin/php|grep pcre
Then post the bug and as the first comment, attach the output of:

Code: Select all

emerge --info
Then attach the contents of

Code: Select all

/var/tmp/portage/dev-lang/php-5.2.8-r2/temp/build.log
You may have to move build.log out of that directory if you're not doing this as root, since other users don't have access there.

And then when you're done, post a link to the bug in this thread. That way we'll have more testers. Advertising is the name of the game. :wink:
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 11:13 pm

Recompiling php/libpcre again. I had to downgrade to get things working. I'll then run the ldd and see where we're at. This server is kind of a mess. Thanks for the help. I feel like we're on to something.

Thanks!
hanji
Server Admin Blog - Uno-Code.com
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 11:18 pm

Okay, after new emerge of php and libpcre.. here is my output of ldd

Code: Select all

ldd /usr/bin/php | grep pcre
libpcre.so.0 => /usr/lib/libpcre.so.0 (0xb7bfa000)
pcre is definitely broken again. I'll move to step two next.

Thanks!
hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Tue Jan 20, 2009 11:22 pm

STOP!

Since "ldd /usr/bin/php | grep pcre" returns something now, we know that php links against system libpcre. The problem is not what we thought it was. System libpcre is supposed to be used.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 11:25 pm

Ok.. stopped compiling r2. So what's next?

hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Tue Jan 20, 2009 11:36 pm

Just to make sure we're on the same page here.
By "broken again" you mean it errors out with Internal pcre_fullinfo() error -3
and by php, you mean php-5.2.8-r2.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Tue Jan 20, 2009 11:41 pm

loki_val wrote:Just to make sure we're on the same page here.
By "broken again" you mean it errors out with Internal pcre_fullinfo() error -3
and by php, you mean php-5.2.8-r2.
Oops.. when I said php, I actually meant 5.2.8-r1 not r2. Should I go for that? I missed that.. sorry. When I saw broken, I get the error.

hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Tue Jan 20, 2009 11:55 pm

It can't hurt trying the newest revision, so please do.
Top
hanj
Veteran
Veteran
User avatar
Posts: 1500
Joined: Tue Aug 19, 2003 2:11 am
Contact:
Contact hanj
Website

  • Quote

Post by hanj » Wed Jan 21, 2009 12:29 am

Okay.. built php-5.2.8-r2 and restarted apache. I still get the error -3 issue with pcre. ldd shows the same link. phpinfo() shows

Code: Select all

PCRE (Perl Compatible Regular Expressions) Support 	enabled
PCRE Library Version 	3.9 02-Jan-2002 
and

Code: Select all

'--with-pcre-regex=/usr' 
Thanks!
hanji
Server Admin Blog - Uno-Code.com
Top
loki_val
Retired Dev
Retired Dev
Posts: 418
Joined: Mon Nov 13, 2006 11:03 am
Location: Denmark

  • Quote

Post by loki_val » Wed Jan 21, 2009 1:22 am

That's certainly weird. A checklist:
Let's' see the output of mod_php's linking and apache's:

Code: Select all

ldd /usr/sbin/apache2|grep pcre
ldd /usr/lib/apache2/modules/libphp5.so|grep pcre
Let's also see the output of:

Code: Select all

emerge -pv apr apache2
and lastly, let's check if phpinfo() is the same as php --info:

Code: Select all

php --info|grep -i pcre
Top
Post Reply

35 posts
  • 1
  • 2
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic