Anyone know wanything about PDO

Get answers here.

Moderators: BBear, theunknownhost, flaguy

Post Reply
User avatar
Sapphyre
Official Test Penquin
Posts: 3337
Joined: Tue Nov 19, 2002 2:50 am
Location: Canada

Anyone know wanything about PDO

Post by Sapphyre » Sat Nov 06, 2010 7:00 pm

How do you load that module in a PHP script?
How would you test if it's working okay?

User avatar
Sapphyre
Official Test Penquin
Posts: 3337
Joined: Tue Nov 19, 2002 2:50 am
Location: Canada

Post by Sapphyre » Sun Nov 07, 2010 9:13 pm

I have found that CPanel has PHP configured with "--disable-pdo" by default

Is there anything we can do with a user level php.ini or are we out of luck?

User avatar
Arf
Official Test Penquin
Posts: 9103
Joined: Tue Apr 09, 2002 12:00 am
Location: IDAHO, USA
Contact:

Post by Arf » Mon Nov 08, 2010 5:55 am

Hi Sapph,
I don't want you to think that I don't want to help or am ignoring your question but I'm clueless about PDO. Never heard of it until you asked. Sorry.

User avatar
Sapphyre
Official Test Penquin
Posts: 3337
Joined: Tue Nov 19, 2002 2:50 am
Location: Canada

Post by Sapphyre » Mon Nov 08, 2010 6:36 pm

Thanks Arf.

It looks like it will require recompiling with that config enabled, and it should be doable by host via EasyApache. I'll let you know how it works out.

User avatar
Sapphyre
Official Test Penquin
Posts: 3337
Joined: Tue Nov 19, 2002 2:50 am
Location: Canada

Post by Sapphyre » Tue Nov 09, 2010 3:03 am

Done! AFAIK they had no problem.

FYI, here's are 2 test scripts to check it - this one checks that the drivers load ok - output should be like:
sqlite
sqlite2
mysql

Code: Select all

<?php
foreach(PDO::getAvailableDrivers() as $driver)
    {
    echo $driver.'<br />';
    }
?>
This one checks that a successful connection to the spec'd DB can be established using PDO. Lack of any error message indicates A-OK (i.e. a blank screen) Otherwise errors about class not found or module not loaded.

Code: Select all

<?php  
/* Connect to an ODBC database using driver invocation */  
$dsn = 'mysql:dbname=OWNER_DBNAME;host=localhost';  
$user = 'OWNER_DBUSER';  
$password = 'PA$$WORD';  
try {  
 $dbh = new PDO($dsn, $user, $password);  
 } catch (PDOException $e) {  
 echo 'Connection failed: ' . $e->getMessage();  
}  
?> 

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest