2

I'm trying to connect to an Oracle 11g Express Edition Database in php via PDO. I have xampp installed, I also have a (supposedly) working pdo_oci extension, which also shows up in phpinfo(). My database works and I can connect to it via an sql console and/or sql developer. I have enabled the extension php_pdo_oci.dll

My code is:

$db_username = "system";
$db_password = "mypass";
$db = "oci:dbname=xe";
$conn = new PDO($db,$db_username,$db_password);

I get the following error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[]: pdo_oci_handle_factory: <> (ext\pdo_oci\oci_driver.c:579)' in ...

So this really doesnt tell anything.

If I try to connect via oci_connect and enable the extension php_oci8_11g.dll (and disable the pdo extension) then with this code:

$conn = oci_connect('system', 'mypass', 'localhost/XE');

I get this error:

Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries in...

So what is Oracle Instant Client? I only downloaded Oracle Express Edition, and added ORACLE_HOME and LD_LIBRARY_PATH as environmental vars and also added the path to PATH as well. Am I missing anything?

Thank you in advance

2
  • Does phpinfo() show the extension is loaded? Commented Mar 5, 2013 at 23:13
  • Hi! Yes, I have this: "PDO Driver for OCI 8 and later enabled" Commented Mar 5, 2013 at 23:33

1 Answer 1

2

Okay, I think I fixed it, so if anyone else needs it:

I downloaded Oracle Instant Client. After this it was still complaining that I should put its place in the PATH, even if it was already there.

So I copied all the files in the Instant Client (probably you don't need all, but anyway) into the apache/bin dir and voila it worked.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.