How to Connect to Remote Oracle Database through PHP?

Connecting Oracle database to a front end application (like PHP, Java, C# or others) seems very difficult. Is there any way to connect Oracle easily?

  • I am new to oracle that I just now downloaded and installed Oracle Database 11g Express Edition in my laptop. I am good at PHP with MySQL which will have only few lines to connect, fetch database as $connection=mysql_connect("localhost","username","password"); $db_select=mysql_select_db("databasename",$connection); $result=mysql_query("SELECT * FROM tablename",$connection); while($row=mysql_fetch_array($result)) echo $row[0].$row[1]; mysql_close($connection); Connecting Oracle with PHP at this link http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/oow10/php_db/php_db.htm says a lot of thing to do which times up to atleast 2hours, but nothing is understood .. Which application can be easily connected ..?

  • Answer:

    Really? Make sure Oracle listener is working and database already running. You can check the database is usable and you can connect to it using sqlplus (quite similar to mysqladmin, just don't expect too much on the similarities). Also make sure client installed and do tnsping to make sure you can make connection to the listener. Then do what PHP docs say about connecting to Oracle. If you need step-by-step tutorial, I suggest you start from here: http://www.phpdeveloper.org/news/15588. If you want some documents from Oracle, you can use the tutorial from Oracle here: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/oow10/php_db/php_db.htmActually, I usually skip two steps above and directly do step 2 from here where you get "Connected to Oracle!" displayed if the connection succeeds. I also use phpinfo() to make sure PHP is installed and configured properly.

Dapid Candra at Quora Visit the source

Was this solution helpful to you?

Other answers

Here is the place to start PHP with Oracle http://www.oracle.com/technetwork/database/database-technologies/php/whatsnew/index.html You can find the material you need. Especially have a look at The Underground PHP Oracle Manual

Ertunç Efeoğlu

Nothing is easy with Oracle! And don't expect any official document either :)

Nitish Devadiga

Ankit Kanchan

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.