Solved

Class 'PDO' not found in C:\wamp\www\mvc\libs\Database.php

Posted on 2011-09-18
7
1,158 Views
Last Modified: 2013-12-13
on wamp
in php.ini
I uncommented
extension=php_pdo_mysql.dll
and restarted server


class Database extends PDO{
parent::__construct();
}


Class 'PDO' not found in C:\wamp\www\mvc\libs\Database.php



creating a class called PDO{}
fixes the error
but I want to call the real PDO

what else should I do
0
Comment
Question by:rgb192
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:acbxyz
ID: 36557224
pdo_mysql is only the mysql-driver for pdo. You also need pdo itself.
Here on linux it is:
extension=pdo.so

You can use phpinfo(); to show which modules are activated.
0
 

Author Comment

by:rgb192
ID: 36557335
i am using wamp

phpinfo()

cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"



extension=php_pdo.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_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll



does this mean that pdo is installed/enabled.
0
 
LVL 10

Expert Comment

by:acbxyz
ID: 36557387
if you put phpinfo() in a file.php and open it in a browser, there should be a section called PDO, which says PDO support enabled.
pdo.png
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:rgb192
ID: 36557830
those sections are not there

what do I have to do to enable pdo in windows apache mysql php
0
 
LVL 10

Accepted Solution

by:
acbxyz earned 500 total points
ID: 36563257
I just installed a WAMPSERVER2.1 from http://www.wampserver.com/en/download.php myself and started it. Without any changes to configuration, pdo was enabled by default, including pdo_mysql and pdo_sqlite.
So I started an up to date xampp for windows and there is pdo with mysql, odbc, sqlite and sqlite2 enabled by default.
Both have a phpinfo()-page by default in their config menu (tray icon with wampserver, http://localhost/xampp/ on the other).
0
 

Author Comment

by:rgb192
ID: 36563922
I am using wampserver 2.0
0
 

Author Closing Comment

by:rgb192
ID: 37128946
I will use wampserver 2.1 now
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question