NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How do I enable PDO support?


Joined: 09 Jun 2013
Posts: 4
Reply with quote
I recently installed tech platform 8.1 - Win32 and MySQL version 5.6.10. I can access the database using the 'old standard methods' without any problems:

This works fine:
$dbc = mysql_connect( $site[ "dbhost" ], $site[ "dblogin" ], $site[ "dbpass" ] );

However, I would like to switch to PDO.

When I try to use the PDO function:
$db = new PDO('mysql:host=$dbhost;dbname=$dbname;charset=ascii', '$dblogin', '$dbpass');

I get an error message "PDO Exception - can not find driver".

How do I install/enable/configure PDO support in my tech platform?

Regards-
Charles
View user's profileFind all posts by cfedonczakSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
obviously, you have to load pdo mysql php extension in php.ini.
Open phpinfo() page, locate php.ini file, find pdo_mysql extension, uncomment it, save the file and restart apache.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Pdo


Joined: 09 Jun 2013
Posts: 4
Reply with quote
Prior to my initial post I enabled php_mysql.dll

And I added:

Extension=php_pdo.dll

But can not find pdo.dll on my machine. Is php_pdo.dll the same thing?

Charles
View user's profileFind all posts by cfedonczakSend private message
Pdo


Joined: 09 Jun 2013
Posts: 4
Reply with quote
I also rebooted the machine after these changes.
View user's profileFind all posts by cfedonczakSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
;extension=php_pdo_mysql.dll
=>
extension=php_pdo_mysql.dll

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
PDO


Joined: 09 Jun 2013
Posts: 4
Reply with quote
After changing the bin/php.ini without luck, I did a search and found several other php.ini files in the Tech platform directories, for development, for production, under PHP/php.ini, etc.

I opened each of them and changed the configuration in them all, then I restarted apache again and it is now working. I don't know which of the files is controlling the installation, but it is NOT the one that is listed in the php.info listing under:
Loaded Configuration File

Now when I run this:
print_r(PDO::getAvailableDrivers());

I get this:
Array ( [0] => mysql [1] => sqlite [2] => sqlite2 )

which I believe is the correct response. So I should be good now.

Another misleading item: the php.info listing shows this:
Configuration File (php.ini) Path = C:\Windows

But there is no php.ini file in my C:\Windows directory. Perhaps I was supposed to copy it there during the installation and missed that step.

So I guess the moral of this story is to know that php.ini files exist in several locations and its not immediately obvious which one is controlling the operation of the server (I still don't know which one fixed it and don't have time to figure it out).e

Thank you-
Charles
View user's profileFind all posts by cfedonczakSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Charles, Configuration File (php.ini) Path plays no role. What you want to check is "Loaded Configuration File" and "Additional .ini files parsed"

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
How do I enable PDO support?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic