Subject: pkg/22066: php4 module can't detect if ZTS is supported or not.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hiramatu@boreas.dti.ne.jp>
List: netbsd-bugs
Date: 07/06/2003 06:29:53
>Number:         22066
>Category:       pkg
>Synopsis:       php4 module can't detect if ZTS is supported or not.
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 05 21:30:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hiramatsu Yoshifumi
>Release:        NetBSD 1.6U
>Organization:
	
>Environment:
	
	
System: NetBSD orinoco.my.domain 1.6U NetBSD 1.6U (Orinoco) #0: Fri Jul 4 20:00:33 JST 2003 root@orinoco.my.domain:/sys/arch/i386/compile/Orinoco i386
Architecture: i386
Machine: i386
>Description:

PHP4 can't load database module. PHP4 is built as ZTS is enabled so it
uses core_globals_id, but modules use core_globals because it can't detect
ZTS is enabled.


>How-To-Repeat:
On NetBSD-current,

# cd /usr/pkgsrc/www/apache2;          make install
# cd /usr/pkgsrc/www/ap2-php4;         make install
# cd /usr/pkgsrc/databases/php4-pgsql; make install
# cat >> /etc/rc.conf
apache=YES
^D
# /usr/pkg/etc/rc.d/apache start

Then, httpd puts following message to /var/log/httpd/error_log

PHP Warning:  Unable to load dynamic library '/usr/pkg/lib/php/20020429/pgsql.so' - /usr/pkg/lib/php/20020429/pgsql.so: Undefined symbol "core_globals" (symnum = 176) in Unknown on line 0

>Fix:

diff -buNr php4.orig/Makefile.common php4/Makefile.common
--- php4.orig/Makefile.common	2003-07-06 04:59:44.000000000 +0900
+++ php4/Makefile.common	2003-07-06 04:59:31.000000000 +0900
@@ -30,4 +30,5 @@
 
 PKG_SYSCONFVAR?=	php
 
+.include "../../mk/pthread.buildlink2.mk"
 .include "../../mk/bsd.prefs.mk"
diff -buNr php4.orig/Makefile.php php4/Makefile.php
--- php4.orig/Makefile.php	2003-07-06 04:59:44.000000000 +0900
+++ php4/Makefile.php	2003-07-06 04:59:31.000000000 +0900
@@ -24,6 +24,8 @@
 CONFIGURE_ARGS+=	--enable-memory-limit
 CONFIGURE_ARGS+=	--enable-track-vars
 
+CONFIGURE_ARGS+=	--enable-experimental-zts
+
 # Support for linking some PHP4 extensions statically into the php CGI and
 # into the apache mod_php.so DSO.
 #
diff -buNr php4.orig/distinfo php4/distinfo
--- php4.orig/distinfo	2003-07-06 04:59:44.000000000 +0900
+++ php4/distinfo	2003-07-06 04:59:30.000000000 +0900
@@ -5,7 +5,6 @@
 SHA1 (patch-aa) = 09fb15fde09bf866d9be016839f33c889d9cefb9
 SHA1 (patch-ab) = daac6888e758b39bc40abed41eba9e55a0fa30e5
 SHA1 (patch-ac) = f3a3a4a5af6f03a6274aa4875a922b838f1bde1b
-SHA1 (patch-ad) = 452ee7c2ef9cb9456653f376c5cc350e227bf10d
 SHA1 (patch-ae) = e7acc06a63f47053c81ab442b53c68d89d122f78
 SHA1 (patch-ag) = a1948af6361e898880e4598654a8ac15fd193b7d
 SHA1 (patch-ah) = 27ac564d2d378852ba328fbc0458d222a4bfdb22
diff -buNr php4.orig/patches/patch-ad php4/patches/patch-ad
--- php4.orig/patches/patch-ad	2003-07-06 04:59:44.000000000 +0900
+++ php4/patches/patch-ad	1970-01-01 09:00:00.000000000 +0900
@@ -1,175 +0,0 @@
-$NetBSD$
---- configure.orig	Thu Sep  5 23:40:53 2002
-+++ configure	Fri May 30 10:04:07 2003
-@@ -3220,9 +3220,10 @@
-     { echo "configure: error: Please specify the path to the root of AOLserver using --with-aolserver=DIR" 1>&2; exit 1; }
-   fi
-   
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
-   
-@@ -3772,9 +3773,10 @@
-   php_build_target=shared
- 
-   
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
-   echo "$ac_t""yes" 1>&6
-@@ -3794,6 +3796,7 @@
- 
- 
-   PHP_VAR_SUBST="$PHP_VAR_SUBST APXS"
-+  INCLUDES="$INCLUDES `apr-config --includes`"
- 
- 
- 
-@@ -3951,9 +3954,10 @@
- 	*** Pike include dir(s) used: $PIKE_INCLUDE_DIR
- 	*** Pike version:             $PIKE_VERSION"
-         
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
- 
-@@ -4304,9 +4308,10 @@
- 	fi
- 	test -f "$ZEUSPATH/web/include/httpext.h" || { echo "configure: error: Unable to find httpext.h in $ZEUSPATH/web/include" 1>&2; exit 1; }
- 	
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
- 	cat >> confdefs.h <<\EOF
-@@ -4424,9 +4429,10 @@
-   fi
- 
-   
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
-   cat >> confdefs.h <<\EOF
-@@ -4454,9 +4460,10 @@
- 		{ echo "configure: error: You did not specify a directory" 1>&2; exit 1; }
- 	fi
- 	
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
- 	PHTTPD_DIR=$withval
-@@ -4565,9 +4572,10 @@
- 	fi
- 	test -f "$PI3PATH/PiAPI/PiAPI.h" || { echo "configure: error: Unable to find PiAPI.h in $PI3PATH/PiAPI" 1>&2; exit 1; }
- 	
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
- 	cat >> confdefs.h <<\EOF
-@@ -4855,9 +4863,10 @@
-   php_build_target=shared
- 
-     
--  enable_experimental_zts=yes
-   if test "$pthreads_working" != "yes"; then
--    { echo "configure: error: ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads." 1>&2; exit 1; }
-+      enable_experimental_zts=no
-+  else
-+      enable_experimental_zts=yes
-   fi
- 
-     echo "$ac_t""yes" 1>&6
-@@ -5396,10 +5405,6 @@
- 
-   fi
- 
--if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
--       CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
--       LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
--fi
- INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
- test -d /usr/ucblib && 
-   if test "/usr/ucblib" != "/usr/lib"; then
-@@ -26847,19 +26852,10 @@
- 
- 
-   else
--    cat >> confdefs.h <<\EOF
--#define HYPERWAVE 0
--EOF
--
-     echo "$ac_t""no" 1>&6
-   fi
- 
- else
--  
--  cat >> confdefs.h <<\EOF
--#define HYPERWAVE 0
--EOF
--
-   echo "$ac_t""no" 1>&6
- 
- fi
-@@ -67729,8 +67725,8 @@
-     if test "$lib_build_shared" != "yes"; then
-         enable_shared=no
-     fi
--    PHP_COMPILE='$(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -c $< && touch $@'
--    CXX_PHP_COMPILE='$(CXX) $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS)  -c $< && touch $@'
-+    PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
-+    CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<'
- ;;
- shared)
-     enable_static=no
-@@ -72831,7 +72827,7 @@
- 
- TSRM_LIB='TSRM/libtsrm.la'
- TSRM_DIR=TSRM
--CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/TSRM"
-+INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
- 
- if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
-   cat >> confdefs.h <<\EOF
-@@ -73625,7 +73621,7 @@
- 
- if test "$enable_debug" != "yes"; then
-   
--  LIBTOOL='$(SHELL) $(top_builddir)/libtool --silent'
-+  LIBTOOL='$(SHELL) $(top_builddir)/libtool'
- 
- fi
- 
>Release-Note:
>Audit-Trail:
>Unformatted: