brianlange Posted August 23, 2011 Share Posted August 23, 2011 I have created a tnsnames.ora file in my local directory however I am not sure it is being used. I have also add the variables tns_admin to .bash_profile When I try to run the php script I get ORA-12154: TNS:could not resolve the connect identifier specified How should I go about troubleshooting this? If I modify value for TNS_ADMIN to a path that doesn't exist the 12154 error does not change. Does this mean it is not reading the .bash_profile file and my local copy of tnsnames.ora? Thanks, -Brian Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/ Share on other sites More sharing options...
gizmola Posted August 23, 2011 Share Posted August 23, 2011 The environment needs to be set for whatever user apache/php is running as. Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/#findComment-1261026 Share on other sites More sharing options...
brianlange Posted August 23, 2011 Author Share Posted August 23, 2011 thanks for the response. The environment needs to be set for whatever user apache/php is running as. Can you tell me what this means? Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/#findComment-1261044 Share on other sites More sharing options...
gizmola Posted August 23, 2011 Share Posted August 23, 2011 If you are running php as say user apache... then the apache user needs to have the appropriate environment variables setup so that it can connect to oracle. When a script is running it is running as the webserver. Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/#findComment-1261050 Share on other sites More sharing options...
brianlange Posted August 23, 2011 Author Share Posted August 23, 2011 Thanks. I can connect to our oracle dev server with the script so I think apache has the necessary permissions. I'm trying to now connect to the production database server. This requires a local tnsnames.ora file however I can't tell if the script is even trying to use this file. It's in the same directory as the php script so I assume it is. Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/#findComment-1261056 Share on other sites More sharing options...
gizmola Posted August 23, 2011 Share Posted August 23, 2011 Are you doing?: putenv(“TNS_ADMIN=/path/to/dir/with/tnsnames.ora/"); $conn = ociplogin('user', 'pw', 'profilename'); Quote Link to comment https://forums.phpfreaks.com/topic/245512-local-tnsnames-file/#findComment-1261117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.