'ORA-12546: TNS:permission denied error connection to remote oracle server

I have two web application and Oracle servers.

Web application server has the following details:

  1. Linux server (LAMP)
  2. oci8
  3. PHP 7.4

Oracle Database server has the following details:

  1. Oracle 19C

I am trying to connect Web Application Server to Oracle Database Remote Server. When I try to connect with remote Oracle server as a result following error shows:

ERROR is ORA-12546: TNS:permission denied.


*Note: While this remote Oracle Database server is connecting successfully from Windows server (WAMP).



Solution 1:[1]

Is this the first running of the web application? Can you connect to the database from the system running your web application using sqlplus?

Solution 2:[2]

In my case was the firewall. I enabled one rule that forbade the connection with the server. I just disabled the rule and the error was gone.

Solution 3:[3]

Had a similar issue. Though i wasn't using LAMP. I had a manually configured apache-php setup. I had to run the command in the Linux server to allow apache to make network connections - apparently, SELinux prevents this by default.

setsebool -P httpd_can_network_connect on

after seeing this: https://stackoverflow.com/a/26349596/9914081 which can be of help too.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 nwoo
Solution 2 mesompi
Solution 3 Samuel Mutemi