PHP & OCI9. No such protocol adapter error.

This is a discussion on PHP & OCI9. No such protocol adapter error. within the PHP Language forums, part of the PHP Programming Forums category; Greetings, I've been developing several PHP-applications using Oracle client 8.2 and PHP 4.3.3 (OCI8 functions). ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-17-2003
gameon@ingenspam.jippii.fi
 
Posts: n/a
Default PHP & OCI9. No such protocol adapter error.

Greetings,

I've been developing several PHP-applications using Oracle client 8.2 and
PHP 4.3.3 (OCI8 functions). Now the management wants to upgrade the
Oracle clients to Oracle9. I updated the client on my own W2K Professional
machine and as I expected, the PHP applications database functionos ceased
to work properly.

I'm receiving the following error according to the logfile:
ocilogon(): _oci_open_server: ORA-12538: TNS:no such protocol adapter

Now I'm sure I have the protocol adapter installed, because I can use
SQL*Plus and other DB-applications with no problems with the Oracle9
client. So the problem must reside somewhere within my PHP-installation.

Is it even possible to use Oracle9 database functions with the PHP
OCI8-functions? Or where should I start searching for the problem
(assuming the TNS-names are all correct. They have not been altered.)?

Any help is greatly appreciated.

--
** Erik Forsström
** http://www.iki.fi/gameon
Reply With Quote
  #2 (permalink)  
Old 09-17-2003
Andy Hassall
 
Posts: n/a
Default Re: PHP & OCI9. No such protocol adapter error.

On 17 Sep 2003 08:53:21 GMT, gameon@ingenspam.jippii.fi wrote:

>I've been developing several PHP-applications using Oracle client 8.2 and
>PHP 4.3.3 (OCI8 functions). Now the management wants to upgrade the
>Oracle clients to Oracle9. I updated the client on my own W2K Professional
>machine and as I expected, the PHP applications database functionos ceased
>to work properly.


So, do you now have two Oracle homes? An 8.1.7 home and a 9.2.0 home?

Have you altered the ORACLE_HOME environment variable accordingly? Also, do
you have TNS_ADMIN set?

Is the new ORACLE_HOME on your PATH environment variable, so that PHP (through
php_oci8.dll) can load the Oracle client libraries?

Remember that the webserver runs under a different environment to your user,
so whilst you may have them set for your user, the web server may not be seeing
them. Use phpinfo() to check them.

>I'm receiving the following error according to the logfile:
>ocilogon(): _oci_open_server: ORA-12538: TNS:no such protocol adapter
>
>Now I'm sure I have the protocol adapter installed, because I can use
>SQL*Plus and other DB-applications with no problems with the Oracle9
>client. So the problem must reside somewhere within my PHP-installation.
>
>Is it even possible to use Oracle9 database functions with the PHP
>OCI8-functions?


Absolutely yes.

> Or where should I start searching for the problem
>(assuming the TNS-names are all correct. They have not been altered.)?


Check environment variables; that's the usual culprit.

Also check file permissions on the Oracle home; by default, Oracle 9i installs
the Oracle home with restricted permissions (this differs from 8i). You may
need to grant at least Read and Execute permissions to the web server's user.

Might be worth looking in sqlnet.log - wherever it happened to dump it.

What's your tnsnames.ora entry look like for the database in question?

Also, what versions are you using exactly; presumably 8.1.7.something
(preferably 8.1.7.4), and 9.2.0.something (preferably 9.2.0.4).

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Reply With Quote
  #3 (permalink)  
Old 09-18-2003
gameon@ingenspam.jippii.fi
 
Posts: n/a
Default Re: PHP & OCI9. No such protocol adapter error.

Andy Hassall <andy@andyh.co.uk> wrote:
> So, do you now have two Oracle homes? An 8.1.7 home and a 9.2.0 home?


> Have you altered the ORACLE_HOME environment variable accordingly? Also, do
> you have TNS_ADMIN set?


> Is the new ORACLE_HOME on your PATH environment variable, so that PHP (through
> php_oci8.dll) can load the Oracle client libraries?


> Remember that the webserver runs under a different environment to your user,
> so whilst you may have them set for your user, the web server may not be seeing
> them. Use phpinfo() to check them.


Thanks very much for your answer! I had already taken care of the environment variables. The problem was very easily solved after I took
my head out of my ass. To get the oracle functions to work, I had to install the respective dll:s to the winnt/system32 directory. That
directory still held the old Oracle8.2 dll:s. Updating the dll:s did the trick.


--
** Erik Forsström
** http://www.iki.fi/gameon
Reply With Quote
  #4 (permalink)  
Old 09-18-2003
Andy Hassall
 
Posts: n/a
Default Re: PHP & OCI9. No such protocol adapter error.

On 18 Sep 2003 05:50:25 GMT, gameon@ingenspam.jippii.fi wrote:

>Andy Hassall <andy@andyh.co.uk> wrote:
>> So, do you now have two Oracle homes? An 8.1.7 home and a 9.2.0 home?

>
>> Have you altered the ORACLE_HOME environment variable accordingly? Also, do
>> you have TNS_ADMIN set?

>
>> Is the new ORACLE_HOME on your PATH environment variable, so that PHP (through
>> php_oci8.dll) can load the Oracle client libraries?

>
>> Remember that the webserver runs under a different environment to your user,
>> so whilst you may have them set for your user, the web server may not be seeing
>> them. Use phpinfo() to check them.

>
>Thanks very much for your answer! I had already taken care of the environment variables. The problem was very easily solved after I took
>my head out of my ass. To get the oracle functions to work, I had to install the respective dll:s to the winnt/system32 directory. That
>directory still held the old Oracle8.2 dll:s. Updating the dll:s did the trick.


Hm, don't do that - there's never any need to put DLLs into the Windows system
directories, and it's certainly not a supported way to run Oracle.

Add $ORACLE_HOME/bin to the PATH environment variable, and remove all the
Oracle DLLs from winnt/system32.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Reply With Quote
  #5 (permalink)  
Old 10-02-2003
Tomasz Kokowski
 
Posts: n/a
Default Re: PHP & OCI9. No such protocol adapter error.

2003-09-17 22:24, Andy Hassall wrote:
[...]>
> Also check file permissions on the Oracle home; by default, Oracle 9i installs
> the Oracle home with restricted permissions (this differs from 8i). You may
> need to grant at least Read and Execute permissions to the web server's user.


It works. Before (default directory permissions for oracle 9i installed)
any ocilogon attempt displayed ugly message :

Warning: ocilogon(): _oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX:
OCI_INVALID_HANDLE

Adding r-x for others on $HOME oracle user directory is the cure.
Thanks!

Tomasz Kokowski
http://www.put.poznan.pl/~tommy


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0