php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56382 Segfault Apache thread
Submitted: 2005-04-24 19:13 UTC Modified: 2005-04-29 11:59 UTC
From: destiney at gmail dot com Assigned:
Status: Not a bug Package: PDO (PECL)
PHP Version: 5.0.3 OS: Linux saturn 2.6.11-gentoo-r6
Private report: No CVE-ID: None
 [2005-04-24 19:13 UTC] destiney at gmail dot com
Description:
------------
I built PDO per docs: http://www.php.net/manual/en/ref.pdo.php

I placed an entry in php.ini:
extension=/usr/lib/php/extensions/no-debug-non-zts-20041030/pdo.so

Viewed phpinfo() output.  Noticed no entry for PDO.

Made a PHP script using dl() to force the PDO entension to load.  Apache logs indicate segfaulting:
[Sun Apr 24 17:29:11 2005] [notice] child pid 754 exit signal Segmentation fault (11)

I am using Apache2 in prefork mode.

Reproduce code:
---------------
<?php

if( dl('pdo.so') )
{
    echo 'pdo.so extension loaded';
}
else
{
    echo 'pdo.so extension failed to load';
}

?>

Expected result:
----------------
I expected to see 'pdo.so extension loaded' on the screen.  Instead I see nothing.

Actual result:
--------------
[Sun Apr 24 18:13:05 2005] [notice] child pid 1425 exit signal Segmentation fault (11)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-24 22:59 UTC] wez@php.net
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
http://bugs.php.net/bugs-generating-backtrace.php

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 PECL better.

also note that you should use:

extension=pdo.so

in the php.ini file, and not the full path.
 [2005-04-27 10:21 UTC] destiney at gmail dot com
I changed the full path in php.ini to just the extension name.  That didn't make a difference.

I'm trying to generate a backtrace but am having issues.  I have recompiled both my Apache and PHP and added debugging.  Here's how I am trying:

> gdb apache2.prefork       
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...(no debugging symbols found)
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) set args -f /etc/apache2/httpd.conf 
(gdb) run
Starting program: /usr/sbin/apache2.prefork -f /etc/apache2/httpd.conf
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 7693)]

Program exited normally.
(gdb) bt
No stack.

What do I need to do to get the backtrace?  Or can you tell me what I'm doing wrong?
 [2005-04-28 15:55 UTC] destiney at gmail dot com
I rebuilt PDO and enabled debugging.  It's acting a bit different now with debugging and being outside of Apache:


> cat pdo.php 
#!/usr/bin/php -q
<?php

error_reporting( E_ALL );
    
$extensions = get_loaded_extensions();

if( in_array( 'pdo', $extensions ) )
{
    echo 'pdo.so extension already loaded';
}
else
{
    if( dl('pdo.so') )
    {
        echo 'pdo.so extension loaded with dl()';
    }
    else
    {
        echo 'pdo.so extension failed to load with dl()';
    }
}

$dsn = 'mysql:dbname=test;host=localhost';
$user = 'root';
$password = 'passwd';

try {
   $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) {
   echo 'Connection failed: ' . $e->getMessage();
}

?>


> ./pdo.php   

Warning: Module 'PDO' already loaded in Unknown on line 0
pdo.so extension failed to load with dl()Connection failed: could not find driver/var/tmp/portage/php-5.0.3-r1/work/php-5.0.3/Zend/zend_execute.c(3255) :  Freeing 0x08613A4C (16 bytes), script=./pdo.php
=== Total 1 memory leaks detected ===



> head /etc/php/cli-php5/php.ini 
[PHP]

extension=pdo.so

;;;;;;;;;;;
; WARNING ;
;;;;;;;;;;;
; This is the default settings file for new PHP installations.
; By default, PHP installs itself with a configuration suitable for
; development purposes, and *NOT* for production purposes.
 [2005-04-29 11:59 UTC] denials at gmail dot com
Sorry, but your problem does not imply a bug in PECL itself.  For a
list of more appropriate places to ask for help using PECL, please
visit http://pecl.php.net/support/ as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PECL.

'pdo' != 'PDO' as returned by get_loaded_extensions(), so PHP was trying to load pdo.so twice.

pdo_mysql.so was not built or loaded when the call to the PDO constructor was issued.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC