简体   繁体   中英

PHP : Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in

i am trying to connect Oracle and PHP, i followed PHP manual for connecting and connected success fully by this below way:

 oci_connect('Username','Password', ' (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = mymachine.oracle.com)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = XE)))' );

But Whenever i am using below method

oci_connect('Username','Password', ,'MYDB');

i'm getting this error:

Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in

So, i have checked all the way some one said use Oracle client files i added tnsnames.ora,ORACLE_HOME,TNS_ADMIN and everything done, from the reference of previous questions but still the problem haven't resolved.

am i doing anything wrong, if please help me to get out from this problem.

Thanks in advance.

终于找到了一个解决办法,就是环境变量TNS_ADMIN不正确。

You can create a page with information about your environment by example:

<?php
phpinfo();
?>

By default, create this page in /var/www/html/phpinfo.php

Look for the TNS_ADMIN entry in the Envioriment session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM