PHP連接Oracle ORA-121154問題解決

錯誤提示:ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!


操作系統:Win7

本地環境:xampp-win32-1.8.2-1-VC9 、 Oracle 10g。

PHP連接測試代碼:

<?php
ocilogon('emesc','emesc','mesb');
//print_r(oci_error());
?>
結果發現提示:ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!


原因分析:之前通過自己配置tnsnames.ora和環境變量來使用PL/SQL,導致安裝oracle客戶端的時候環境變量異常。導致PHP無法解析連接字符串。


解決方案:在系統中添加:名爲TNS_ADMIN的環境變量:D:\oracle\product\10.2.0\db_1\network\ADMIN。測試連接成功!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章