PHP/Mapscript regex problem -- Any volunteers?

Bill Binko bill at BINKO.NET
Mon May 16 03:17:30 EDT 2005


Just a quick update to this.. I have made some progress, and have some
thoughts.

First, the good news.  I have managed to get a build of Mapserver with
PHP/Mapscript built on Mandrake 10.1 using PHP 4.3.8.  The trick was to
include regex/regex_extra.h in map.h right after regex/regex.h.  I've
included a patch, but it's not real useful without a bit more explanation.

It seems that at least in this distribution of PHP 4.3.8
(php-4.3.8-3.3.101mdk.src.rpm), PHP has seen the error of its ways (sort
of), and is no longer exporting symbols that match those in the system
regex.  They are in fact exporting php_reg*() methods and then issuing
#defines like this one (from regex_extra.h):

#define regcomp php_regcomp

So, if you look at the libphp_common.so, you'll find:

[bill at fastcat php-4.3.8]$ nm libphp_common.so | grep -i regcomp
0008b5d0 t _php_regcomp
00051c10 T php_regcomp

This SHOULD also mean that we should be able to build against PHP without
needing the PHP source, and that running as a DSO should be OK.  The only
downside would be that if you chose to do so, the command-line/CGI
programs would link against libphp_common.so at runtime.  That seems
better than statically loading the .o's from PHP into libmap.a to me.

(Before I realized this (during the thrashing phase of the investigation
:), I figured out a more convoluted solution, but we'll let that be a
backup plan.)

At this point, I'm interested in how common this new symbol change is: is
it something that we can say, "After PHP 4.3.XXX, we don't need the
source"?  Or is it something specific to the Mandrake distribution?

Could I get some feedback from other users?  I can compile them offline if
you'd like and post a response.  Basically, I need to know:

1) What version/distribution you're running
2) If you have a libphp_common.so (some versions don't)
3) Do you have a regex/regex_extra.h
4) The results of 'nm libphp_common.so | grep -i regcomp'

For my part, I'll modifying the configure script to try to build with only
the include files for PHP and reporting on how that works out.

Bill

PS: I've sent a note to the PHP developer who last worked on this, but
have not gotten a response yet.

-------------- next part --------------
Index: map.h
===================================================================
RCS file: /data2/cvsroot/mapserver/map.h,v
retrieving revision 1.408
diff -U5 -r1.408 map.h
--- map.h	13 May 2005 13:14:47 -0000	1.408
+++ map.h	16 May 2005 06:54:17 -0000
@@ -258,10 +258,11 @@
 /* The regex lib from the system and the regex lib from PHP needs to
  * be separated here. We separate here via its directory location.
  */
 #ifdef USE_PHP_REGEX
 #include "regex/regex.h"
+#include "regex/regex_extra.h"
 #else
 #include <regex.h>
 #endif
 
 #ifdef USE_MING


More information about the mapserver-dev mailing list