dev-amany Posted January 25, 2010 Share Posted January 25, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/ Share on other sites More sharing options...
akitchin Posted January 25, 2010 Share Posted January 25, 2010 have you checked to verify that the required *.dll extension files are where they need to be (ie. in PHP's extensions folder)? Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001530 Share on other sites More sharing options...
dev-amany Posted January 25, 2010 Author Share Posted January 25, 2010 have you checked to verify that the required *.dll extension files are where they need to be (ie. in PHP's extensions folder)? Well, no and not sure about how to do it, would you please guide me? thanks Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001542 Share on other sites More sharing options...
akitchin Posted January 26, 2010 Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001603 Share on other sites More sharing options...
dev-amany Posted January 26, 2010 Author Share Posted January 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001609 Share on other sites More sharing options...
dev-amany Posted January 26, 2010 Author Share Posted January 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001622 Share on other sites More sharing options...
akitchin Posted January 26, 2010 Share Posted January 26, 2010 glad to help - please mark this as solved if you manage to get that extension working. try looking at www.php.net for the file. Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001649 Share on other sites More sharing options...
PFMaBiSmAd Posted January 26, 2010 Share Posted January 26, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001727 Share on other sites More sharing options...
dev-amany Posted January 26, 2010 Author Share Posted January 26, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/189778-problem-with-pdo/#findComment-1001860 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.