External Oracle DB connection

Do you have questions regarding other database enginges (not MySQL) -- ask here!

Moderators: macek, egami, gesf

User avatar
RhedSequoia
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Aug 26, 2010 5:49 am
Location: Virginia, USA

External Oracle DB connection

Postby RhedSequoia » Mon Sep 27, 2010 2:59 pm

I'm writing a script at work that queries an Oracle 11g database for customer information to use for populating XML files that are used to test a web application.

I've been reading "The Underground PHP and Oracle Manual" but all of their examples and discussions assume that the Oracle DB is on localhost. My script has to tunnel through a firewall (I had sys punch me a hole) and connect to a db server. Using the same information (i.e. IP:port/SID, uname, pass) that works with SQL Developer, my script:

Code: Select all

$c=oci_connect('User','Pass','xx.xx.xx.xx:1521/DEMO')


stops my script... DEAD! No errors. No info.

Any ideas on how I can solve this mystery? I greatly appreciate any help.

User avatar
RhedSequoia
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Aug 26, 2010 5:49 am
Location: Virginia, USA

Re: External Oracle DB connection

Postby RhedSequoia » Wed Sep 29, 2010 10:05 am

I done some researching online and found a suggestion to add this code:

Code: Select all

if(!function_exists('oci_connect')) die('Oracle Not Installed');


I added it and wouldn't you know it, I got the die statement.

I've installed Oracle 11g Client and Oracle SQL Developer so what do I have to do to have PHP recognize the Oracle client?

User avatar
RhedSequoia
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Aug 26, 2010 5:49 am
Location: Virginia, USA

Re: External Oracle DB connection

Postby RhedSequoia » Wed Sep 29, 2010 3:36 pm

Okay, more information...

Put phpinfo(8) into your php script. This will show you all of the installed modules. (http://us.php.net/manual/en/function.phpinfo.php) If oci8 is not install, you must reinstall it. I am using php-5.3.3-Win32-VC9-x86.msi. When you add Oracle, DO NOT ADD BOTH 10g and 11g. I have found that my Apache 2.2.16 server won't start up if I do so. I only installed Oracle 11g since I am using the Oracle 11g client.

After the reinstall, open your php.ini file. At or near the end of the file you should see:

[PHP_OCI8_11G]
extension=php_oci8_11g.dll


Now, check your Apache 2.2 httpd.conf file and make sure that you have the PHP Installer Edits at the end of the file.

Start the server and then run your script. You should connect to the Oracle database defined in your oci_connect.


Return to “Other Database Engines”

Who is online

Users browsing this forum: No registered users and 0 guests

cron