Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to Oracle using PHP

Tags:

php

oracle

How do I connect to a remote Oracle database instance from PHP?

I need to query (read only) the remote Oracle database for some information; do I need to have an Oracle Instant Client installed?

Is the OCI extension for PHP enough?

like image 659
Ady Romantika Avatar asked Sep 17 '08 13:09

Ady Romantika


People also ask

Can PHP connect to Oracle Database?

To use the Easy Connect naming method, PHP must be linked with Oracle 10g or greater Client libraries. The Easy Connect string for Oracle 10g is of the form: [//]host_name[:port][/service_name]. From Oracle 11g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name].

How do I connect to Oracle Database?

To connect to Oracle Database from SQL*Plus: If you are on a Windows system, display a Windows command prompt. At the command prompt, type sqlplus and then press the key Enter. At the user name prompt, type your user name and then press the key Enter.

Can I connect to Oracle Database with MySQL?

You can use the SQL Gateway from the ODBC Driver for Oracle to query Oracle data through a MySQL interface.

Can we use Oracle with laravel?

Now as influential as it may be, Oracle Database is not supported out of the box by Laravel. However, like a lot of things that are not supported out of the box, we can actually make Laravel work with Oracle Database. PHP has had support for Oracle Database since 2003 through the OCI8 PHP extension.


2 Answers

From PHP Manual

  • You will need the Oracle client libraries to use this extension.

  • The most convenient way to install all the required files is to use Oracle Instant Client, which is available from Oracle's site

like image 131
user15453 Avatar answered Oct 11 '22 19:10

user15453


The best manual for using PHP with Oracle is Underground PHP Oracle Manual. Periodically updated. For example last update describe new cool OCI (Oracle Call Interface) features. I found it by accident and since then has never regretted. Start from that good manual.

like image 39
drnk Avatar answered Oct 11 '22 19:10

drnk