problem with PDO

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dev-amany
Forum Newbie
Posts: 3
Joined: Mon Jan 25, 2010 3:14 pm

problem with PDO

Post by dev-amany »

Hi
I am a new php developer and making my 1st PDO connection.

I am working on Windows platform, I have PHP 5.2.9 running on Apache server with MySQL 5.1.32.

I activated the following modules in the php.ini :
extension=php_pdo.dll
extension=php_mysql.dll
extension=php_pdo_mysql.dll

I am trying to create a new PDO object by the following line :
$db = new PDO("mysql:dbname=schema;host=localhost","user", "password");

when I run the project a Fatal error is thrown :
"Class 'PDO' not found in .....(the file path in local disk)........... "

I don't know how to fix the problem, can anyone help?
thanks in advance

yours
Amany
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: problem with PDO

Post by Christopher »

I don't think you need extension=php_pdo.dll or extension=php_mysql.dll in 5.3. Create a script with phpinfo(); in it to see you configuration and if PDO is loading. Also make sure that MySQL is working. I think you need to load the mysql lib somewhere too (Apache? PHP?)
(#10850)
dev-amany
Forum Newbie
Posts: 3
Joined: Mon Jan 25, 2010 3:14 pm

Re: problem with PDO

Post by dev-amany »

arborint wrote:I don't think you need extension=php_pdo.dll or extension=php_mysql.dll in 5.3. Create a script with phpinfo(); in it to see you configuration and if PDO is loading. Also make sure that MySQL is working. I think you need to load the mysql lib somewhere too (Apache? PHP?)
thank your Arborint for your reply. Actually I'm using PHP 5.2, but I managed to fix the problem thank you.... The problem was that the file system I unzipped the extensions and set the server pointing to is different than the one needed by PHP which is realized when I made phpinfo();

Thank you so much
Post Reply