Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle TNS Permission Denied *

I'm using:

  • CentOS 6.7
  • Zend.1.2.15 using oci8, using instantclient 11.2 x64
  • PHP 5.4.45

Trying to connect to an Oracle:

  • Oracle Database 10g Release 10.2.0.4.0

Already checked credentials, already tried to connet to other Oracle server but the error still the same:

12546 ORA-12546: TNS:permission denied *

Already gave 0777 permission to /usr/local/oracle/11.2/client64/ following some answer around but none of them solved.

Server does not have the IP in any sort of blacklist.

The same code runs in any other Windows PC with OracleInstantClient and no further configuration was needed on the server about giving an IP permissions to access or any permission at all.

Is there something more that I can check to solve this?

like image 247
Fabiano Avatar asked Sep 15 '15 17:09

Fabiano


1 Answers

After hours searching I found this article: http://www.emsperformance.net/2013/12/20/connecting-to-oracle-database-from-php-with-oci8/ which is by far the best article explaining the installation process of LAMP, Oracle, Zend.

The setting I was missing is:

setsebool -P httpd_can_network_connect on

Edit: After a while this answer still looks useful to someone, worths to say that this happens because the machine has SELinux activated, usually in the enforcing mode. I would not recommend to disable SELinux, but setting it to permissive looks to ease the process of identifying some problems with it. You can check SELinux status by sestatus.

A full list of booleans on SELinux is available at: https://wiki.centos.org/TipsAndTricks/SelinuxBooleans

Overall information: https://wiki.centos.org/HowTos/SELinux

like image 55
Fabiano Avatar answered Nov 15 '22 14:11

Fabiano