External Oracle DB connection

A

Anonymous

Guest
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:
$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.
 
I done some researching online and found a suggestion to add this code:
Code:
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?
 
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.
 
Back
Top