Class PDO not found

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
lisamarie_tt
Forum Commoner
Posts: 32
Joined: Fri Jul 15, 2005 8:20 am

Class PDO not found

Post by lisamarie_tt »

Ok I need to connect to a DB2 database and execute a prepared statment with input/output parameters. To do this I upgraded to php5.1.

I altered the php.ini file as documentation dicated for setting up 5.1 and PDO. There are no errors in my ini file since my webserver (apache 2), works fine.

I'm trying to run a test connection to my database using the following,

Code: Select all

<?
try 
{
  $dbh = new PDO('odbc:DB2', 'uname', 'password');
  echo "Connected\n";
} 
catch (Exception $e) 
{
  echo "Failed: " . $e->getMessage();
}
?>
I'm getting the following error:
Fatal error: Class 'PDO' not found at line 5

I've tried to figure out why i'm getting this problem, but keep coming up at dead ends. Is it a configuration problem. Suggestions on this would be greatly appreciated.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

check in phpinfo() what extensions are loaded, if it's not listed, you may have changed the php.ini incorrectly. Alternately, you can post your extension section so we can judge for ourselves..
lisamarie_tt
Forum Commoner
Posts: 32
Joined: Fri Jul 15, 2005 8:20 am

Post by lisamarie_tt »

extension directory
extension_dir = "C:/php/ext"

extension section

Code: Select all

;extension=php_mbstring.dll
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=php_pdo.dll
extension=php_pdo_odbc.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Did you install PHP as a module in Apache? If so, were there any popups during Apache's launch? Have you checked the Apache error logs for ones related to PDO?
lisamarie_tt
Forum Commoner
Posts: 32
Joined: Fri Jul 15, 2005 8:20 am

Post by lisamarie_tt »

I have included php as a load module in Apache.
There are no popups during start and or restart of the webserver.
I've checked the apache error log there are no errors pertaining to php or PDO. The error occurs when rendering the test connection page.

What does this mean?

Were there any problems in my extension block submitted?

How do I check to see PDO is enabled, where in the phpinfo file will i see this? On obersvation there are no referecnes to PDO anywhere on the page the spits php information.

How should I proceed?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

lisamarie_tt wrote:I have included php as a load module in Apache.
There are no popups during start and or restart of the webserver.
I've checked the apache error log there are no errors pertaining to php or PDO. The error occurs when rendering the test connection page.

What does this mean?It would seem it didn't have any issues loading, but....
lisamarie_tt wrote:Were there any problems in my extension block submitted?
I'm not seeing anything..
lisamarie_tt wrote:How do I check to see PDO is enabled, where in the phpinfo file will i see this? On obersvation there are no referecnes to PDO anywhere on the page the spits php information.
I haven't used PDO, but is should get listed in phpinfo() if and when loaded like any other extension.
lisamarie_tt wrote:How should I proceed?
I have no idea. The following is a list of DLL's php_pdo.dll (the version you are using) links to. It may have silently found that one or more of them couldn't be loaded, and decided to not continue loading when php starts. Check to make sure you have the startup errors directive turned on in php.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32.DLL
URLMON.DLL
USERENV.DLL
USP10.DLL
UTILDLL.DLL
UXTHEME.DLL
VERSION.DLL
W32TOPL.DLL
WINHTTP.DLL
WININET.DLL
WINMM.DLL
WINSCARD.DLL
WINSPOOL.DRV
WINSTA.DLL
WINTRUST.DLL
WLDAP32.DLL
WMI.DLL
WSOCK32.DLL
WTSAPI32.DLL
WZCDLG.DLL
WZCSAPI.DLL
WZCSVC.DLL
lisamarie_tt
Forum Commoner
Posts: 32
Joined: Fri Jul 15, 2005 8:20 am

Post by lisamarie_tt »

Thanks for you help...

I'll keep you posted on my problem (no pun intended).
I'll turn on the start up error flag and se what happens.
lisamarie_tt
Forum Commoner
Posts: 32
Joined: Fri Jul 15, 2005 8:20 am

Post by lisamarie_tt »

heres a snippet of the error log part of the ini file. Notice that the error flags are on

Code: Select all

; Print out errors (as a part of the output).  For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below).  Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = On

; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed.  It's strongly recommended to keep
; display_startup_errors off, except for when debugging.
display_startup_errors = On

; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
log_errors = On
Howerer in phphinfo display they are off.

display_startup_errors Off Off

I made the chages, saved the file and I restatred the web-sever.
And still the flags show off.
Could it be that the php.ini is not being read properly?

I'm pulling at straws now. I'm a bit at a loss, I've been at it for the greater part of three days !!!!
manas10
Forum Newbie
Posts: 1
Joined: Wed Sep 16, 2009 4:14 pm

Re: Class PDO not found

Post by manas10 »

I had similar issue. I would check phpinfo(), under php_core extension_dir ./ ; then I corrected to extension_dir c:/php5/ext . And it did work.
If you want to test, pleae try this
<?php
foreach(PDO::getAvailableDrivers() as $driver)
{
echo $driver.'<br />';
}
?>
---
regards
Manas
Frontiersoft.net
Post Reply