ID: 33283
User updated by: david dot prusak at copart dot com
Reported By: david dot prusak at copart dot com
Status: Open
Bug Type: PDO related
Operating System: *
PHP Version: 5.1-b1
New Comment:
When I installed the link you provided on my Windows machine,
php/apache starts, but I get an error "Unable to load dynamic library
'C:\php\ext\php_pdo.dll' - the specified procedure could not be found.
This also occurs with php_pdo_odbc.dll
On my solaris machine, configure doesn't work. It's informing me that
the IBM_DB2 environment wasn't set, but I did run it and it is set.
./configure --with-apache2=../httpd-2.0.53 --prefix=/www/php
--with-mysql=/usr/local/mysql --with-gd=/usr/local
--with-apxs2=/www/apache/bin/apxs --with-config-file-path=/www/php/etc
--with-ibm-db2=/export/home/db2inst1/sqllib/
checking for Adabas support... no
checking for SAP DB support... no
checking for Solid support... no
checking for IBM DB2 support... ./configure: !: not found
no
configure: error:
build test failed. Please check the config.log for details.
You need to source your DB2 environment before running PHP configure:
# . $IBM_DB2/db2profile
configure:63159: checking for IBM DB2 support
configure:63230: gcc -o conftest -g -O2 -D_POSIX_PTHREAD_SEMANTICS
-R/usr/ucbl
ib -L/usr/ucblib -R/usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.2
-L/usr/local/li
b/gcc/sparc-sun-solaris2.9/3.4.2 -R/usr/local/lib -L/usr/local/lib
-R/usr/local/
mysql/lib/mysql -L/usr/local/mysql/lib/mysql conftest.c
-L/export/home/db2inst1/sqllib//lib -ldb2
-lmysqlclient -lgd -lresolv -lm -ldl -lnsl -lsocket -lgcc -lxml2
-lz -lico
nv -lm -lsocket -lnsl -lxml2 -lz -liconv -lm -lsocket -lnsl 1>&5
configure: failed program was:
#line 63219 "configure"
#include "confdefs.h"
char SQLExecute();
int main() {
SQLExecute();
return 0;
}
--David
Previous Comments:
------------------------------------------------------------------------
[2005-06-10 18:39:15] david dot prusak at copart dot com
Well, I installed all this on my solaris box. Accessing the same page,
I get this in my apache error.log
[Fri Jun 10 09:29:03 2005] [notice] child pid 19516 exit signal
Segmentation fault (11)
Removing the "prepare" doesn't segfault apache. The behavior is
identical to the windows version.
------------------------------------------------------------------------
[2005-06-10 17:22:03] david dot prusak at copart dot com
No, adding that didn't stop the GPF, sorry.
------------------------------------------------------------------------
[2005-06-09 23:59:47] [EMAIL PROTECTED]
If you add:
$stmt = null;
$dbh = null;
to the end of your script, does the segfault go away?
------------------------------------------------------------------------
[2005-06-09 21:26:39] david dot prusak at copart dot com
Oops sorry about that.
This fails with a gpf:
<?php
try {
$dbh = new PDO('odbc:DATABASE', 'USER', 'PASS')
$stmt = $dbh->prepare("SELECT * FROM TABLE");
} catch (Exception $e) {
echo "Failed: " . $e->getMessage();
}
?>
While this works just fine and prints "Connected",
<?php
try {
$dbh = new PDO('odbc:DATABASE', 'USER', 'PASS')
print "Connected\n";
} catch (Exception $e) {
echo "Failed: " . $e->getMessage();
}
?>
When I use exec, I don't get the GPF, but I'm also not getting the
correct results. When trying to query a fake table, I don't get an
error. When I query the correct table, I don't get a count.
When I put in an incorrect database, user or password, I do get the
correct error. So that tells me that I can connect to the database.
<?php
try {
$dbh = new PDO('odbc:DATABASE', 'USER', 'PASS')
print "Connected<br>";
$count = $dbh->exec("SELECT * FROM FAKETABLE");
print "Count: $count";
} catch (Exception $e) {
echo "Failed: " . $e->getMessage();
}
?>
I did verify the php.ini is correct. I put in a typo in the ini file
to see if Apache will err on start up and it did. (brute force method
:) )
Hope that's not too much information.
--David
------------------------------------------------------------------------
[2005-06-09 19:39:53] [EMAIL PROTECTED]
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();
?>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/33283
--
Edit this bug report at http://bugs.php.net/?id=33283&edit=1