|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40211 dba_firstkey segfaults when used with mod_php5
Submitted: 2007-01-23 14:40 UTC Modified: 2007-02-02 01:00 UTC
From: stuhood at webmail dot us Assigned:
Status: No Feedback Package: DBM/DBA related
PHP Version: 5.2.0 OS: Red Hat w/ 2.4.21-32.0.1.EL
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-01-23 14:40 UTC] stuhood at webmail dot us
This bug affects 5.1.4, 5.2.0 and latest CVS on this system, compiled with "--enable-dba=shared --with-db4=/usr/local/BerkeleyDB.4.5/" (or 4.3), and with the dba shared extension in my php.ini file. httpd version is Apache/2.0.46. `php run-tests.php ext/dba` runs without errors.

-rw-r--r-- thedatabase.db

Reproduce code:
The following script works correctly from the command line, but causes httpd processes to segfault. With a dba_exists call instead of firstkey, it works fine, so I'm fairly certain its a problem with firstkey:

        $db = dba_open("thedatabase.db", "r", "db4");
        $key = dba_firstkey ($db);
                print "Success: ".$key."\n";

Expected result:
Should see Success: (first key)

Actual result:
httpd child segfaults (11) and displays a 500 error.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-23 14:51 UTC]
We also need this thedatabase.db, please put it somewhere and put the URL here.
 [2007-01-23 20:38 UTC] stuhood at webmail dot us
Alright, here's a link to the database, but as I said: this script (and others) execute just fine from the command line.
 [2007-01-23 21:05 UTC]
Please try using this CVS snapshot:
For Windows:

Cannot reproduce with both CLI and Apache.
 [2007-01-24 08:26 UTC] judas dot iscariote at gmail dot com
works perfectly fine here, with db-4.4.20 in both 5.2.0 and latets CVS.

are you sure that your system libraries/headers are not messed up ?
 [2007-01-24 15:34 UTC] stuhood at webmail dot us
Its entirely possible... but if that is the case, then PHP shouldn't compile or work from the command line, correct?

The system has:

libdb-4.* for each version are symlinked to /lib/

I could try reinstalling BDB I guess, but I still want to hear any other suggestions you all might have.

 [2007-01-24 15:38 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2007-01-25 14:14 UTC] stuhood at webmail dot us
Here are the backtraces affecting httpd when php is built with db-4.3 and db-4.5. Its not crashing where I expected, and its crashing in a different place for both versions.

You'll note that the 4.3 trace mentions I tried moving that file and then recompiling php, but httpd would throw an "error while loading shared library" and exit 0177.

So... do I need to recompile apache as well?
 [2007-01-25 14:43 UTC]
Please try latest CVS snapshot first.

>So... do I need to recompile apache as well?
If you apache uses db4 - yes, you'll have to recompile it.
 [2007-02-02 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 18 02:01:30 2020 UTC