Jump to content

problem with PDO


dev-amany

Recommended Posts

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

Link to comment
Share on other sites

on the windows platform, the extensions are often in the:

 

C:\Path\To\PHP\ext

 

directory. you'll want to check that the selected extensions' .dll files are in there. another resource that might help you look for where they should be is the phpinfo function, which will tell you what include paths are enabled.

Link to comment
Share on other sites

have you checked to verify that the required *.dll extension files are where they need to be (ie. in PHP's extensions folder)?

 

Ok, I've checked it and here's the location :

extension_dir = "c:/php/ext"

 

which is correct, and i made sure that the extension files needed are located on the folder... now what should I do?

Thank you

Link to comment
Share on other sites

on the windows platform, the extensions are often in the:

 

C:\Path\To\PHP\ext

 

directory. you'll want to check that the selected extensions' .dll files are in there. another resource that might help you look for where they should be is the phpinfo function, which will tell you what include paths are enabled.

 

There's some progress now, I guess I found the problem, Thanks to you and phpinfo() I found that the extension_dir which is mentioned in phpinfo() is different than the one I extracted the extensions and pointing the php.ini to, however taking another look in the file system i found there's a missing file php_pdo_mysql

 

that's what I'm gonna do now is to search for it over the internet and place it in the extensions' folder.

 

Thank you akitchin for your help

Link to comment
Share on other sites

How did you originally obtain php and install php?

 

If you used the full .zip package, all of the .dll files would already be present and you would not need to be finding individual files. It also sounds like the php.ini that you are changing is not the one that php is using.

 

If you used the .msi installer package, you are expected to enable extensions by going through the Windows control panel's add/remove item for php.

 

If you used one of the WAMP all in one packages, you are expected to enable extensions by going through the control panel for that package.

Link to comment
Share on other sites

How did you originally obtain php and install php?

 

If you used the full .zip package, all of the .dll files would already be present and you would not need to be finding individual files. It also sounds like the php.ini that you are changing is not the one that php is using.

 

Yes, I used the zipped file. anyway I obtained the missing file and connection is working now.... Thank you PFMaBiSmAd and akitchin

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.