0

I am having an issue where my connection to mysql server fails with the above message . I have made sure that the

  1. extension folder = ext is enabled,
  2. The extension=php_pdo_mysql.dll is enabled as well
  3. In the extension directory the dll is present.

I must mention this - I have manually downloaded and configured php , apache2 and mysql. although i can run phpinfo correctly , I am not sure if i have to enable something else so as to make my Db connections work

Although if I run this test

if (!defined('PDO::ATTR_DRIVER_NAME')) {
 echo 'PDO unavailable';
}
 else echo('pdo is available');

I get the message PDO is available. When I was researching for this error I came across php code to test pdo is available? question wherein i happened to get to the above code fragment.

any help would be well appreciated.

thanks

Community
  • 1
  • 1
Gagan
  • 5,416
  • 13
  • 58
  • 86
  • 2
    does MySQL show up in [PDO::getAvailableDrivers](http://php.net/manual/en/pdo.getavailabledrivers.php)? – Marc B Mar 10 '14 at 04:38
  • @MarcB .. print_r(PDO::getAvailableDrivers()); prints an empty array . is there something that I am missing ? – Gagan Mar 10 '14 at 04:42
  • there ya go. pdo's installed and working, but you have no drivers installed for it. so your php_pdo_mysql.dll or whatever isn't being loaded. You'll have to check php's errors logs to see if there's anything explaining why. – Marc B Mar 10 '14 at 04:42
  • @Samt MySQL is running – Gagan Mar 10 '14 at 04:42
  • @marc so how do i install drivers and which ones - sorry for being a newb.. – Gagan Mar 10 '14 at 04:44
  • ah .. so i get this in the log file : PHP Startup: pdo_mysql: Unable to initialize module\nModule compiled with build ID=API20100525,NTS,VC9\nPHP compiled with build ID=API20100525,TS,VC9\nThese options need to match\n in Unknown on line 0 .. which means i am using a wrong php version .. been using Apache/2.4.7 (Win32) PHP/5.4.26 together. – Gagan Mar 10 '14 at 04:48
  • (N)on-(T)hread (S)safe v.s. (T)hread (S)afe. you need to find a .dll version which has been compiled the same as the overall php system. – Marc B Mar 10 '14 at 04:59

0 Answers0