On 4/28/05, Greg Donald <[EMAIL PROTECTED]> wrote: > On 4/28/05, Dan Scott <[EMAIL PROTECTED]> wrote: > > Does the segfault only occur when you load PDO into mod_php? > > > > If you haven't already tried it, try using PHP CLI to reproduce the > > problem instead; that removes one major variable (Apache) from the > > equation. Ensure that PHP is built with --enable-debug, then rebuild > > PDO and try to reproduce the segfault from the command line. > > 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. > > -- > Greg Donald > Zend Certified Engineer > http://destiney.com/ >
Oops, didn't mean to take this off-list... So three things: 1. If you print the results of get_loaded_extensions(), you'll see that pdo turns up as 'PDO', but you're looking for 'pdo' -- so the result of your first if() is FALSE. 2. You then try loading pdo.so again, but it's already loaded by php.ini, therefore you get the Warning and your own error message. 3. You plan on connecting to MySQL, but don't appear to have loaded pdo_mysql.so anywhere. So you need to fix that. Dan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php