ID:               13876
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Analyzed
+Status:           Closed
 Bug Type:         DBM/DBA related
 Operating System: NetBSD + Linux
 PHP Version:      4.2.0RC4
 New Comment:

This bug has been fixed in CVS.

thanks - this should now work with 4.2.0 and greater 


Previous Comments:
------------------------------------------------------------------------

[2002-04-18 01:36:31] [EMAIL PROTECTED]

Full patch to fix this - attached - let me know if you want the patch
as a file - I can send it.

--- /usr/src/php/php-4.1.2/ext/dba/config.m4    Thu Jun 28 23:16:28
2001
+++ config.m4   Thu Apr 18 13:19:19 2002
@@ -230,6 +230,5 @@
   PHP_SUBST(DBA_SHARED_LIBADD)
 else
   AC_MSG_RESULT(no)
-  AC_DEFINE(HAVE_DBA, 0, [ ])
 fi
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_cdb.c Thu Feb 28 16:25:58
2002
+++ dba_cdb.c   Thu Apr 18 13:27:47 2002
@@ -20,6 +20,10 @@
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_CDB
 #include "php_cdb.h"
 
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_db2.c Thu Feb 28 16:25:58
2002
+++ dba_db2.c   Thu Apr 18 13:27:23 2002
@@ -16,10 +16,14 @@
   
+----------------------------------------------------------------------+
  */
 
-/* $Id: dba_db2.c,v 1.20 2002/02/28 08:25:58 sebastian Exp $ */
+/* $Id: dba_db2.c,v 1.20.2.1 2002/04/08 06:36:39 derick Exp $ */
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_DB2
 #include "php_db2.h"
 #include <sys/stat.h>
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_db3.c Thu Feb 28 16:25:58
2002
+++ dba_db3.c   Thu Apr 18 13:27:57 2002
@@ -20,10 +20,14 @@
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_DB3
 #include "php_db3.h"
-#include <sys/stat.h>
 
+#include <sys/stat.h>
 #include <string.h>
 #ifdef DB3_INCLUDE_FILE
 #include DB3_INCLUDE_FILE
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_dbm.c Thu Feb 28 16:25:59
2002
+++ dba_dbm.c   Thu Apr 18 13:28:15 2002
@@ -20,6 +20,10 @@
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_DBM
 #include "php_dbm.h"
 
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_gdbm.c        Thu Feb 28 16:25:59
2002
+++ dba_gdbm.c  Thu Apr 18 13:28:30 2002
@@ -20,6 +20,10 @@
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_GDBM
 #include "php_gdbm.h"
 
--- /usr/src/php/php-4.2.0RC2/ext/dba/dba_ndbm.c        Thu Feb 28 16:25:59
2002
+++ dba_ndbm.c  Thu Apr 18 13:28:42 2002
@@ -20,10 +20,15 @@
 
 #include "php.h"
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #if DBA_NDBM
 #include "php_ndbm.h"
 
 #include <fcntl.h>
+
 #ifdef NDBM_INCLUDE_FILE
 #include NDBM_INCLUDE_FILE
 #endif


------------------------------------------------------------------------

[2001-10-30 12:42:07] [EMAIL PROTECTED]

If php is configured and installed on a system without any
db libraries, then a db library, e.g. gdbm, is installed 
afterwards, it's not possible to separately build the DBA 
module as a shared extension.  The problem occurs because 
when a db library is not found when php is configured, the 
php_config.h file written out contains the line:

        #define HAVE_DBA 0

Later, when the DBA module is phpize'd and configured, the
HAVE_DBA definition from php_config.h overrides the value 
set in the local config.h file, which causes all of the 
code to be ifdef'd out.  Even when this problem is fixed, 
the various dba_<db>.c files that implement the PHP 
functions for a particular db library will have all of 
their code ifdef'd out since the DBA_<DB> definitions in 
the local config.h file aren't used.

The complete fix is simple:

    1) Remove the line "AC_DEFINE(HAVE_DBA, 0, [ ])" from
       ext/dba/config.m4.
    2) For each dba_<db>.c file, add at the top before
       php.h is included the following lines:

        #ifdef HAVE_CONFIG_H
        #include "config.h"
        #endif

I have a patch relative to the php-4.0.6 source tree that 
makes the above changes, located at:

        http://jgrind.org/~jlam/patch.dba-4.0.6



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=13876&edit=1

Reply via email to