You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Garnier, Jeremie" <JG...@nds.com> on 2007/01/15 15:28:05 UTC

APR, Oracle and PHP

Hi,

 

I try to use APR with Oracle and PHP but it doesn't work.

Did you know how to use APR (and APR-util) with PHP in order to make some Oracle operations?

It is possible to make it via PHP? And I don't see Oracle in APR-util? 

Thanks,

 

Jérémie GARNIER

 

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


RE: APR, Oracle and PHP

Posted by Bojan Smojver <bo...@rexursive.com>.
On Tue, 2007-01-16 at 08:55 +0100, Garnier, Jeremie wrote:

> Thanks for your answer. It will be nice if there is an Oracle DBD driver... but where I can get the version 1.3.0?

http://apr.apache.org/anonsvn.html

Don't forget to run buildconf.

-- 
Bojan


RE: APR, Oracle and PHP

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

Thanks for your answer. It will be nice if there is an Oracle DBD driver... but where I can get the version 1.3.0?
Thanks,

Jérémie 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : lundi 15 janvier 2007 22:28
À : Justin Erenkrantz
Cc : Garnier, Jeremie; dev@apr.apache.org
Objet : Re: APR, Oracle and PHP

On Mon, 2007-01-15 at 10:49 -0800, Justin Erenkrantz wrote:

> You probably need to provide some more details, but APR-util 1.2.x and
> higher wraps the Oracle's C API via the APR DBD interface.

AFAIK, Oracle DBD driver is only present in the trunk of APU (i.e.
1.3.0).

-- 
Bojan

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


RE: APR, Oracle and PHP & CGI

Posted by Bojan Smojver <bo...@rexursive.com>.
Quoting "Garnier, Jeremie" <JG...@nds.com>:

> I see on my cgi that the function OCIHandleAlloc returns -2... Why   
> this function does not work on my cgi? It is a problem with the   
> dbd_oracle_env?

I have to admit that my Oracle experience isn't great, so I wouldn't  
even venture a guess. I'm not even sure what -2 as a return code there  
means, but maybe you can turn on debugging (examples are in the  
driver) and this should give you better information as to what kind of  
problem Oracle is having.

> Another question: where can I find some documentation/examples using  
>  mod_dbd. The aim is to use mod_dbd in order to manage pooling.  
> First  I test APR/APU and after APR/APU works, I will test mod_dbd...

Most likely one of the Apache lists, as mod_dbd is part of Apache.

-- 
Bojan

RE: APR, Oracle and PHP & CGI

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

There is always the problem on my cgi whereas there is not this problem with the dbd test program.
I see on my cgi that the function OCIHandleAlloc returns -2... Why this function does not work on my cgi? It is a problem with the dbd_oracle_env?
Another question: where can I find some documentation/examples using mod_dbd. The aim is to use mod_dbd in order to manage pooling. First I test APR/APU and after APR/APU works, I will test mod_dbd...
Thanks,

Jérémie

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : vendredi 19 janvier 2007 00:36
À : Garnier, Jeremie
Cc : Justin Erenkrantz; dev@apr.apache.org
Objet : Re: APR, Oracle and PHP & CGI

Quoting "Garnier, Jeremie" <JG...@nds.com>:

> I don't know why the test dbd works fine but when i make a cgi in   
> order to use it. It doesn't work.
>
> It loads the oracle driver (via the function apr_dbd_get_driver but   
> the function a^pr_dbd_open doesn't work (into apache, not with the   
> dbd program (in httpd/srclib/apr-util/test)).

Your best bet is probably to run the program under GDB to see what's  
really going on.

-- 
Bojan
***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


Re: APR, Oracle and PHP & CGI

Posted by Bojan Smojver <bo...@rexursive.com>.
Quoting "Garnier, Jeremie" <JG...@nds.com>:

> I don't know why the test dbd works fine but when i make a cgi in   
> order to use it. It doesn't work.
>
> It loads the oracle driver (via the function apr_dbd_get_driver but   
> the function a^pr_dbd_open doesn't work (into apache, not with the   
> dbd program (in httpd/srclib/apr-util/test)).

Your best bet is probably to run the program under GDB to see what's  
really going on.

-- 
Bojan

RE: APR, Oracle and PHP & CGI.. and now mod_dbd

Posted by Bojan Smojver <bo...@rexursive.com>.
On Mon, 2007-01-22 at 12:31 +0100, Garnier, Jeremie wrote:

> Now, I will use mod_dbd… Do you know how include mod_dbd API in a cgi
> script (or C program) as there no example or documentation of mod_dbd…

Never tried that, so I won't be of much help there.

-- 
Bojan


RE: APR, Oracle and PHP & CGI.. and now mod_dbd

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

 

So have some news about APR/APU, Oracle and PHP & CGI... 

I make a CGI script and I can access to the Oracle XE database... To resolve the problem, I make some modification in order to link apache with APR/APU and in the driver of oracle (make another initialisation of the environment)...

And so, it works!!! Good results...

Now, I will use mod_dbd... Do you know how include mod_dbd API in a cgi script (or C program) as there no example or documentation of mod_dbd...

Thanks all for your help...

 

Jérémie GARNIER

 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : vendredi 19 janvier 2007 00:48
À : Garnier, Jeremie
Cc : Justin Erenkrantz; dev@apr.apache.org
Objet : Re: APR, Oracle and PHP & CGI

 

Quoting "Garnier, Jeremie" <JG...@nds.com>:

 

> It loads the oracle driver (via the function apr_dbd_get_driver but   

> the function a^pr_dbd_open doesn't work (into apache, not with the   

> dbd program (in httpd/srclib/apr-util/test)).

 

One more suggestion here: I had some issues with Oracle Instant Client  

10g connecting to the database and the whole thing was related to  

server spec passed to the driver. It had to be like this:  

//server.domain.name:port/db, where all values were as specified in  

/etc/tnsnames.ora file. You may also want to check the environment  

variables that your Apache instance sees - Oracle may need some set.

 

-- 

Bojan

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


Re: APR, Oracle and PHP & CGI

Posted by Bojan Smojver <bo...@rexursive.com>.
Quoting "Garnier, Jeremie" <JG...@nds.com>:

> It loads the oracle driver (via the function apr_dbd_get_driver but   
> the function a^pr_dbd_open doesn't work (into apache, not with the   
> dbd program (in httpd/srclib/apr-util/test)).

One more suggestion here: I had some issues with Oracle Instant Client  
10g connecting to the database and the whole thing was related to  
server spec passed to the driver. It had to be like this:  
//server.domain.name:port/db, where all values were as specified in  
/etc/tnsnames.ora file. You may also want to check the environment  
variables that your Apache instance sees - Oracle may need some set.

-- 
Bojan

APR, Oracle and PHP & CGI

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

 

I don't know why the test dbd works fine but when i make a cgi in order to use it. It doesn't work.

It loads the oracle driver (via the function apr_dbd_get_driver but the function a^pr_dbd_open doesn't work (into apache, not with the dbd program (in httpd/srclib/apr-util/test)).

Thanks

 

Jérémie GARNIER

 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : mercredi 17 janvier 2007 22:32
À : Garnier, Jeremie
Cc : Justin Erenkrantz; dev@apr.apache.org
Objet : RE: APR, Oracle and PHP

 

On Wed, 2007-01-17 at 12:24 +0100, Garnier, Jeremie wrote:

 

> I juste have a question. When I compile APR/APU with oracle, why I

> don't I the library apr_dbd_oracle.so?

 

Are PHP and Apache linked against the new APU? What does ldd give you?

 

AFAIK, once you compile the Oracle driver in 1.3.0, it becomes part of

libaprutil - it's not a standalone shared object. That's at least how

libaprutil looks on my machine.

 

I would run ldd/nm to see what is actually in the libaprutil that your

PHP and/or Apache link against. There should be dbd_oracle_* symbols in

it...

 

-- 

Bojan

 

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


RE: APR, Oracle and PHP

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

 

Thanks for your answer... I solve some problems...

Actually, I compile Apache with APR/APU and in the APU library, there are the references to dbd_oracle_*

But I always have the driver loading error when I launch apache... Is there anymore configuration in apache in order to load the oracle driver? Actually, I declare in httpd.conf:

<VirtualHost 127.0.0.1:8085>

    DBDriver oracle

    DBDParams "user=nds pass=oracle dbname=XE server=137.0.0.1:1521"

    DBDMin 5

    DBDKeep 20

    DBDMax 50

    DBDExptime 120

    #DBDPrepareSQL, DBDPersist

</VirtualHost>

Is there another thing to configure?

Thanks.

 

Jérémie

 

 

 

 

 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : mercredi 17 janvier 2007 22:32
À : Garnier, Jeremie
Cc : Justin Erenkrantz; dev@apr.apache.org
Objet : RE: APR, Oracle and PHP

 

On Wed, 2007-01-17 at 12:24 +0100, Garnier, Jeremie wrote:

 

> I juste have a question. When I compile APR/APU with oracle, why I

> don't I the library apr_dbd_oracle.so?

 

Are PHP and Apache linked against the new APU? What does ldd give you?

 

AFAIK, once you compile the Oracle driver in 1.3.0, it becomes part of

libaprutil - it's not a standalone shared object. That's at least how

libaprutil looks on my machine.

 

I would run ldd/nm to see what is actually in the libaprutil that your

PHP and/or Apache link against. There should be dbd_oracle_* symbols in

it...

 

-- 

Bojan

 

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


RE: APR, Oracle and PHP

Posted by Bojan Smojver <bo...@rexursive.com>.
On Wed, 2007-01-17 at 12:24 +0100, Garnier, Jeremie wrote:

> I juste have a question. When I compile APR/APU with oracle, why I
> don’t I the library apr_dbd_oracle.so?

Are PHP and Apache linked against the new APU? What does ldd give you?

AFAIK, once you compile the Oracle driver in 1.3.0, it becomes part of
libaprutil - it's not a standalone shared object. That's at least how
libaprutil looks on my machine.

I would run ldd/nm to see what is actually in the libaprutil that your
PHP and/or Apache link against. There should be dbd_oracle_* symbols in
it...

-- 
Bojan


RE: APR, Oracle and PHP

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

 

I see how to use APR...

I juste have a question. When I compile APR/APU with oracle, why I don't I the library apr_dbd_oracle.so?

Because when I launch apache, it says :

PHP Warning:  PHP Startup: oci8: Unable to initialize module\nModule compiled with module API=20050922, debug=0, thread-safety=0\nPHP    compiled with module API=20060613, debug=0, thread-safety=0\nThese options need to match\n in Unknown on line 0

PHP Warning:  PHP Startup: soap: Unable to initialize module\nModule compiled with module API=20050922, debug=0, thread-safety=0\nPHP    compiled with module API=20060613, debug=0, thread-safety=0\nThese options need to match\n in Unknown on line 0

PHP Warning:  PHP Startup: tokenizer: Unable to initialize module\nModule compiled with module API=20050922, debug=0, thread-safety=0\nPHP    compiled with module API=20060613, debug=0, thread-safety=0\nThese options need to match\n in Unknown on line 0

PHP Warning:  Zend Optimizer does not support this version of PHP - please upgrade to the latest version of Zend Optimizer in Unknown on line 0

PHP Warning:  Zend Debug Server does not support this version of PHP - please upgrade to the latest version of Zend Debug Server in Unknown on line 0

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

[Wed Jan 17 12:00:28 2007] [notice] Apache/2.2.3 (Unix) PHP/5.2.0 configured -- resuming normal operations

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:28 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

[Wed Jan 17 12:00:48 2007] [error] [client 127.0.0.1] /usr/local/apache2/cgi-bin/cgictest.cgi: error while loading shared libraries: libapr-1.so.0: cannot open shared object file: No such file or directory

[Wed Jan 17 12:00:48 2007] [error] [client 127.0.0.1] Premature end of script headers: cgictest.cgi

[Wed Jan 17 12:00:48 2007] [error] [client 127.0.0.1] File does not exist: /usr/local/apache2/htdocs/favicon.ico

[Wed Jan 17 12:00:49 2007] [crit] (70023)This function has not been implemented on this platform: DBD: driver for [DBDriver unset] not available

[Wed Jan 17 12:00:49 2007] [crit] (70023)This function has not been implemented on this platform: DBD: failed to initialise

 

So, DBD failed as I declare in httpd.conf:

<VirtualHost 127.0.0.1:8085>

    DBDriver oracle

    DBDParams "user=nds pass=oracle dbname=XE server=nux2187:1521"

    DBDMin 5

    DBDKeep 20

    DBDMax 50

    DBDExptime 120

    #DBDPrepareSQL, DBDPersist

</VirtualHost>

 

With DBDriver oracle, apache will load apr_dbd_oracle.so but this library is not present!!!

Any Ideas?

Thanks,

 

Jérémie

 

 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : mardi 16 janvier 2007 22:13
À : Garnier, Jeremie
Cc : Justin Erenkrantz; dev@apr.apache.org
Objet : RE: APR, Oracle and PHP

 

On Tue, 2007-01-16 at 16:53 +0100, Garnier, Jeremie wrote:

 

> How I can simply use it to make some test with oracle (10g)?

 

apr_dbd_init

apr_dbd_get_driver

apr_dbd_open

apr_dbd_query/select

apr_dbd_close

 

> How can I manage the pool connection using mod_dbd?

 

Once you link Apache against APR/APU 1.3.0, in much the same way as with

any other database back-end, I would think.

 

-- 

Bojan

 

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


RE: APR, Oracle and PHP

Posted by Bojan Smojver <bo...@rexursive.com>.
On Tue, 2007-01-16 at 16:53 +0100, Garnier, Jeremie wrote:

> How I can simply use it to make some test with oracle (10g)?

apr_dbd_init
apr_dbd_get_driver
apr_dbd_open
apr_dbd_query/select
apr_dbd_close

> How can I manage the pool connection using mod_dbd?

Once you link Apache against APR/APU 1.3.0, in much the same way as with
any other database back-end, I would think.

-- 
Bojan


RE: APR, Oracle and PHP

Posted by "Garnier, Jeremie" <JG...@nds.com>.
Hi all,

 

It is ok, I found the Oracle DBD driver and it compiles.

I have some questions about APR. I can't use it directly with PHP so I make CGI script to use APR and APR-Util.

How I can simply use it to make some test with oracle (10g)?

How can I manage the pool connection using mod_dbd?

Thanks,

 

Jérémie

 

 

-----Message d'origine-----
De : Bojan Smojver [mailto:bojan@rexursive.com] 
Envoyé : lundi 15 janvier 2007 22:28
À : Justin Erenkrantz
Cc : Garnier, Jeremie; dev@apr.apache.org
Objet : Re: APR, Oracle and PHP

 

On Mon, 2007-01-15 at 10:49 -0800, Justin Erenkrantz wrote:

 

> You probably need to provide some more details, but APR-util 1.2.x and

> higher wraps the Oracle's C API via the APR DBD interface.

 

AFAIK, Oracle DBD driver is only present in the trunk of APU (i.e.

1.3.0).

 

-- 

Bojan

 

***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
*********************************************************************************** 


Re: APR, Oracle and PHP

Posted by Bojan Smojver <bo...@rexursive.com>.
On Mon, 2007-01-15 at 10:49 -0800, Justin Erenkrantz wrote:

> You probably need to provide some more details, but APR-util 1.2.x and
> higher wraps the Oracle's C API via the APR DBD interface.

AFAIK, Oracle DBD driver is only present in the trunk of APU (i.e.
1.3.0).

-- 
Bojan


Re: APR, Oracle and PHP

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 1/15/07, Garnier, Jeremie <JG...@nds.com> wrote:
> I try to use APR with Oracle and PHP but it doesn't work.
>
> Did you know how to use APR (and APR-util) with PHP in order to make some
> Oracle operations?
>
> It is possible to make it via PHP? And I don't see Oracle in APR-util?

You probably need to provide some more details, but APR-util 1.2.x and
higher wraps the Oracle's C API via the APR DBD interface.

I have no idea if PHP can use the APR DBD interface though - so I
would expect that PHP would have to link against Oracle directly
instead of going through APR-util.  -- justin