2

I have been trying to connect remotely to oracle using pdo I have enable pdo driver

extension=php_pdo_odbc.dll

But getting this error

"SQLSTATE[HY000]: OCIEnvNlsCreate: Check the character set is valid and that PHP has access to Oracle libraries and NLS data (ext\pdo_oci\oci_driver.c:614)"

Here is my code for connection

try {
    $dbh = new PDO("oci:dbname='My server ip'/orcl;charset=UTF-8", "my user name", "my password");

    }
catch (PDOException $e)
    {     echo $e->getMessage();     }
Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
rameez931
  • 21
  • 3

1 Answers1

0

I had the same errormessage after I installed multiple copies of ODAC/ODT because I didn't know what version I needed to have my Visual Studio projects (Windows Forms app and a ASP.NET website) connect to a Oracle database. While fixing this connection problem in the end, I broke my PHP/PDO website which also needed to connect to the same Oracle database. It gave me the same errormessage as in your question. I removed all ODAC/ODT client installations and also the Oracle Server to be sure and then I reinstalled only the Oracle Server (in my case Oracle 11.2 Express 64bit) and it worked again. I could connect again from SQL Developer and also through PHP/PDO. After that I installed the correct ODAC/ODT (32bit(!) version because of my 32bit Visual Studio) and now also my Visual Studio Forms project AND ASP.NET website could connect to the Oracle server.

Jan
  • 2,165
  • 1
  • 18
  • 13