Home >Backend Development >PHP Tutorial >PHP connection to Oracle ORA-121154 problem solving_PHP tutorial
Error message: ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!
Operating system: Win7
Local environment: xampp-win32-1.8.2-1-VC9, Oracle 10g.
PHP connection test code:
[php]
ocilogon('emesc','emesc','mesb');
//print_r(oci_error());
?>
ocilogon('emesc','emesc','mesb');
//print_r(oci_error());
?>The result found a prompt: ocilogon(): ORA-12154: TNS:could not resolve the connect identifier specifie!
Cause analysis: I used PL/SQL by configuring tnsnames.ora and environment variables myself, which caused the environment variables to be abnormal when installing the Oracle client. Causes PHP to be unable to parse the connection string.
Solution: Add an environment variable named TNS_ADMIN to the system: D:oracleproduct10.2.0db_1networkADMIN. Test connection successful!