PDA

View Full Version : Php Data Objects (PDO) on Hostmonster



studio
05-19-2008, 07:12 PM
Hello,

Is the PDO interface available on Hostmonster? I've tried using it and gotten a "class not found" error (or something to that effect) and I've checked phpinfo(). I would like to get confirmation before I write it off.

Thank you,
studio

EDIT:

Forgot to mention that I am using Php5.

linFox
05-21-2008, 07:52 AM
I just tried a simple test script and received no errors, so I can assume that it is enabled.
phpinfo() does report it is enabled too. If yours doesn't I'd talk to support.

studio
05-21-2008, 01:06 PM
Ok, thank you. I'll contact support.

For reference, here is what I used (this works on my home machine):

<?php

try {
$db = new PDO('mysql:host=localhost;dbname=DBNAME', 'username', 'password');
} catch (PDOException $e) {
echo $e->getMessage();
}

?>

Output:

Fatal error: Class 'PDO' not found in /path/to/file.php on line 4

studio
05-21-2008, 01:14 PM
Found a solution to my own problem:

There is a walkthrough on enabling PDO (http://helpdesk.hostmonster.com/kb/index.php?x=&mod_id=2&id=364). It involves setting the following in your php.ini.

extension=pdo.so
extension=pdo_mysql.so
extension_dir="/usr/lib/php/extensions/no-debug-non-zts-20060613/"

Thanks again.