Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connect PHP to ORACLE 10g XE

805244Nov 29 2010 — edited Nov 30 2010
I've tried to connect PHP 5.2.14 to Oracle 10g XE without any success.
I'm running Windows 7 with Apache 2.2.As an installation guide i've followed: http://wiki.oracle.com/page/PHP+Oracle+FAQ .
As i try to connect using:
$conn = oci_connect("HR", "myhrpassword", "//localhost/XE");

In php.ini i've uncommented the line: "extension=php_oci8.dll" and the: "extension_dir = "c:\php\ext" under the "On windows:" line.
I get this error: "Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in c:\apache2.2\htdocs\test.php"
I've verified that OCI8 is installed by running: "<?php phpinfo(); ?>". Under OCI8 i have: http://img251.imageshack.us/img251/1660/oci8.jpg

I've verified my tnsnames.ora and it looks like this:
"
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Dan-PC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
"

My sqlnet.ora is "SQLNET.AUTHENTICATION_SERVICES = (NONE)" (was NTS but still didn't worked).

I don't know what to do more. I've tried allmost everything but can't get it to work.

Kind Regards,
Cearnau Dan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2010
Added on Nov 29 2010
6 comments
2,964 views