views:

553

answers:

4

how to connect oracle by php on MAC OS X?

oci?

+1  A: 

I would think OCI would be the way to go. PHP has a module for it.

+1  A: 

The PDO abstraction layer can be used to connect to, and perform actions on, an Oracle DB. Here's an article on how to use PDO with Oracle from the Oracle website.

It's also possible to use OCI.

The Oracle PHP Development Centre will have lots more useful information on using Oracle and PHP together.

Rich Adams
A: 

I dont know the Mac specifically, nor PHP, but you usually need to install the Oracle Client tools (Instant Client).

http://www.oracle.com/technology/tech/oci/instantclient/index.html

Once installed you modify the TNSNAMES.ORA file to point to the server and instance name of the Oracle database.

Then you can use the PHP "database connection" stuff (sorry) to create a connection and running your SQL statements.

Use the SQL*PLUS client to check the connection works:

ie.

c:> SQLPLUS

CONNECT scott/tiger@mydatabase

If the TNSNAMES.ORA is correct you should get a connection, or at least "username/password incorrect" that proves you got communication with the Oracle instance.

If you get TNS-12521 (?) errors then your TNSNAMES.ORA is incorrect.

Guy
A: 

Hello!

Connecting to an oracle database should be no problem with the oci-interface, using "oci_connect()" for example.

Further examples are here: http://php.net/manual/en/oci8.setup.php

But I do not understand, what the remark MAC OS X means - are you running an apache locally?

Hope this helps, Bastian

bastianhuebner