PDO + Oracle = Loads of Anti-Fun

Okay, so in playing around with some of the somewhat bleeding edge stuff (well, okay, so PDO isn’t that bleeding edge) on my development server, I’m trying to get Oracle support working for a simple script. It doesn’t want to seem to cooperate, and I just wanted to make sure I’m not doing something I shouldn’t be (or are forgetting something) – because it still dosen’t work.

Here’s what I’ve done so far:

  • compiled PHP 5.2.0 with:
    • –enable-pdo=shared
    • –with-pdo-oci=shared
    • –with-sqlite=shared
    • –with-pdo-sqlite=shared
  • Installed both PDO 1.0.3 and PDO_OCI 1.0 from scratch
  • Verified that the modules are in the “ext_dir” specified in the pnp.ini
  • added the lines to load them dynamically:
    • extension=pdo.so
    • extension=pdo_oci.so
  • When I make a phpinfo() page, it shows both that PDO is loaded and that “PDO Driver for OCI 8 and later” is “enabled”

And, of course, the code:

[php]
$sql=sprintf(‘generic SQL here’);
$arr=array(
‘oci:dbname=DBINTNSNAMES’,
‘user’,
‘pass’
);
$dbh = new PDO($arr[0],$arr[1],$arr[2]);
[/php]

This yields the lovely error message below:
“Fatal error: Uncaught exception ‘PDOException’ with message ‘could not find driver’ in /www/web/test/getbal2.php:36 Stack trace: #0 /www/web/test/getbal2.php(36): PDO->__construct(‘oci:dbname=PHIS…’, ‘user’, ‘pass’) #1 {main} thrown in /www/web/test/getbal2.php on line 36

Suggestions? Ideas? Is there something I’m missing?

4 comments

  1. Any chance of this stuff getting moved back in to PECL so one doesn’t have to scour the internet looking for why it doesn’t work when the PHP manual suggests installing PDO from PECL?

    Like

  2. for me, i was getting same “could not find driver error”…
    windows binary had following files which i enabled in php.ini
    extension=php_pdo.dll
    but php’s /ext folder didnt have specific drivers for database…
    aka: php_pdo_mysql.dll,php_pdo_oci.dll

    so i went to php.net and downloaded the php windows source, and got the .dlls from the /ext directory that werent included, and added them in my /ext folder, and in php.ini wrote:
    extension=php_pdo.dll
    extension=php_pdo_mysql.dll
    extension=php_pdo_oci.dll

    then all was well.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s