Error connecting ORACLE database with PHP

1

When trying to connect to an Oracle ORACLE database the following error appears:

  

TNS: listener was not given SERVICE_NAME in CONNECT_DATA

I have already set up php.ini and include the following lines:

extension=php_oci8.dll
extension=php_oci8_11g.dll
extension=php_oracle.dll

Note: My connection file is as follows:

$conexao = oci_connect('usuario', 'senha', 'nome_do_banco');

    
asked by anonymous 04.11.2015 / 11:45

1 answer

0

From what I've researched, you need to configure the Oracle server reference on the client machine, in the tnsnames.ora file.

A .ora file would have a syntax something like this:

SID_LIST_LISTENER =
    (SID_LIST =
        (SID_DESC =
            (SID_NAME = PLSExtProc)
            (ORACLE_HOME = C:\oracle\product.2.0\db_1)
            (PROGRAM = extproc)
        )
    )
LISTENER =
    (DESCRIPTION_LIST =
        (DESCRIPTION =
            (ADDRESS =
                (PROTOCOL = TCP)
                (HOST = MYSERVER)
                (PORT = 1521)
            )
        )
    )

Source: link

    
04.11.2015 / 12:10