Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.misc -> Re: Connect php to oracle

Re: Connect php to oracle

From: Andy Hassall <>
Date: Thu, 08 Jan 2004 23:58:44 +0000
Message-ID: <>

On Thu, 08 Jan 2004 22:42:17 +0100, Tore Skogly <tore.skogly_at_no.spam.invalid> wrote:

>Andy Hassall wrote:
>> Check permissions on your Oracle home. By default, the user your web
>> server
>> runs as will not have read or execute permission on it - you may have to
>> grant it to the IIS guest account, depending on how you've got your web
>> server set up.
>>>Environment settings TNS_ADMIN and ORACLE_HOME have been set using "My
>>>Computer" -> "advanced" ->.... too.
>> What have they been set to?
>I changed permissions on ORACLE_HOME, and added sufficient privileges to the
>IIS guest account (actually - to be sure i granted these privileges to all
>users while testing...).

 Try opening a file in the Oracle home from PHP to make sure (assuming in all this that you're running PHP as a SAPI module rather than CGI).

>These environment variables has been set:
>ORACLE_HOME C:\oracle\ora92
>Path C:\oracle\ora92\bin
>ORACLE_SID newdb2
>TNS_ADMIN C:\oracle\ora92\network\admin
>TWO_TASK C:\oracle\ora92\network\admin\tnsnames.ora

 Presumably as System environment variables and not User ones? Has the webserver been restarted so it can see them? Echo out the values from PHP so you can see what environment it's seeing.

 echo $_ENV['ORACLE_HOME'];

 ... etc., or just use the phpinfo() function to dump everything to the browser and check it's set; you've got to tackle the 'Error while trying to retrieve text for error' problem first before moving on to fixing the TNS issues.

 Whilst not immediately relevant, that value for TWO_TASK looks suspect; shouldn't it be a connect identifier if you're going to use it? The docs imply that it doesn't apply to Windows anyway, though.

 On Windows you don't actually need ORACLE_HOME set; you can get away with just having PATH set, since Oracle can get the rest out of the registry. Might be an idea to just simplify things down to just PATH and making completely sure the permissions are right (Read & Execute, List Folder Contents and Read for IUSR_<computer name>).


Andy Hassall <> / Space: disk usage analysis tool
<> / <>
Received on Thu Jan 08 2004 - 17:58:44 CST

Original text of this message