Jump to content

Archived

This topic is now archived and is closed to further replies.

brianlange

local tnsnames file

Recommended Posts

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

Share this post


Link to post
Share on other sites

The environment needs to be set for whatever user apache/php is running as.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Are you doing?:

 

putenv(“TNS_ADMIN=/path/to/dir/with/tnsnames.ora/");
$conn = ociplogin('user', 'pw', 'profilename');

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.