NYCPHP Meetup

NYPHP.org

[nycphp-talk] connecting to oracle w/ php

Mitch Pirtle mitchy at spacemonkeylabs.com
Tue Jun 22 17:58:04 EDT 2004


David Vogel wrote:

> Just wondering if anyone with experience using php to connect to an 
> oracle server has any insight into a problem I'm having.
>
> using PHP 4.3.2 on apache 1.3.27 to connect to oracle 8i on win2k
> OCIlogon() connects successfully but only after about 30 seconds.
>
> I never done much with oracle and I suspected a server config problem, 
> but the oracle guys from the company (diebold, ugh) who set up the 
> server disagree so I'm wondering if there are any known problems to 
> watch out for w/ php, env vars that may be set wrong or something like 
> that.  I'm pretty sure it's not a network problem or anything, 
> connecting from diebold's front end is very fast, only having probs 
> from www script.  Thoughts?


OCI connections have a significant amount of overhead, and can cause 
noticeable performance hits as a result.  My favorite solution to this 
dilemma is to set up sql relay, as it can cache your database 
connections - as well as give you a bit of added flexibility with 
switching database servers and platforms...

    http://sqlrelay.sf.net

PHP-specific stuff here:

    http://sqlrelay.sourceforge.net/sqlrelay/programming/php.html

Another option for you is to bypass the PHP->Oracle stuff and use an 
abstraction layer to manage that for you, one very popular one is ADOdb:

    http://adodb.sourceforge.net/

And on this very list is a very, VERY good guy and programmer that works 
on PEAR::DB:

    http://pear.php.net/manual/en/package.database.php

...although I assume that PEAR::DB uses the internally-supplied PHP to 
Oracle driver.  Is that correct, Dan?

-- Mitch



More information about the talk mailing list