ID: 33283
Updated by: [EMAIL PROTECTED]
Reported By: david dot prusak at copart dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Windows XP
PHP Version: 5.0.4
New Comment:
Sounds like two different issues, neither of which is PDO specific ;-)
Check that you were modifying the right php.ini file, and that you
restarted apache after changing it. (phpinfo() will help you to figure
that out).
Your script is broken, btw. You catch the exception, effectively
ignoring the error, and then continue to use the $dbh even though you
"know" it isn't there. You should move that code inside the try {}
block, just after you echo "Connected";
The GPF concerns me, but I suspect it will go away once you load PDO
correctly. If you're feeling motivated, can you try pruning down your
script to the smallest possible test case that reproduces the GPF? I'm
hoping you can cut it down to something like this:
<?php
class foo {
function __construct() {
throw new Exception("bang");
}
}
try {
$foo = new foo;
} catch (Exception $e) {
echo "Failed " . $e->getMessage();
}
$foo->bar();
?>
Previous Comments:
------------------------------------------------------------------------
[2005-06-09 19:10:13] david dot prusak at copart dot com
Might want to ingore the gdb information I provided. It's not correct
on the windows system. I more than happy to help debug. Just let me
know what you need and how I can get it to you.
Thanks,
--David
------------------------------------------------------------------------
[2005-06-09 17:56:53] david dot prusak at copart dot com
Description:
------------
When attempting to use the PDO class, Apache GPF's.
My PHP.ini reads as follows:
extension_dir = "C:\php\ext"
extension=php_pdo.dll
extension=php_pdo_odbc.dll
Apache/PHP doesn't alert me that the libraries couldn't be loaded.
The code provided is 100% reproducable on my system.
Removing all the code except the database connection doesn't crash.
The code does say that the connection was established.
I'm not 100% sure if it's php or my php.ini file. The backtrace tells
me that the class doesn't exist. That leaves me with a suspicion that
it could be config related.
Reproduce code:
---------------
<?php
try {
$dbh = new PDO('odbc:IBMDB2', 'USER', 'PASS',
array(PDO_ATTR_PERSISTENT => true));
echo "Connected\n";
} catch (Exception $e) {
echo "Failed: " . $e->getMessage();
}
$email = "[EMAIL PROTECTED]";
$stmt = $dbh->prepare("CALL SPROC(?, ?)");
$stmt->bindParam(1, $email);
$stmt->bindParam(2, $return_value, PDO_PARAM_STR, 80);
$stmt->execute();
print "procedure returned $return_value\n";
?>
Expected result:
----------------
Results from the database without error
Actual result:
--------------
(gdb) target exec C:\php\php.exe
(gdb) run test.php
Starting program: /cygdrive/c/php/php.exe test.php
PHP Fatal error: Class 'PDO' not found in c:\Documents and
Settings\dmprusak1\My
Documents\htdocs_80\pages\project_manager\test.php on line 17
Fatal error: Class 'PDO' not found in c:\Documents and
Settings\dmprusak1\My
Documents\htdocs_80\pages\project_manager\test.php on line 17
Program received signal SIGSEGV, Segmentation fault.
0x77ea3c00 in RpcRaiseException ()
from /cygdrive/c/WINDOWS/system32/rpcrt4.dll
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33283&edit=1