Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Oracle Functions : ocilogon

ocilogon

Alias of oci_connect (PHP 4, PHP 5, PECL oci8:1.0-1.2.4)


Code Examples / Notes » ocilogon

ca dot ddy

You will get the error ORA-12154 when there seems to be no right to access the tnsnames.ora file.
I could fix the problem set the apache user to oracle and the group to dba. (It depends which user and group for oracle you created on your system).
For me it isen't risky cause I am sitting in an unreachable WAN. After the changes the problem was fixed.
My environment :
php4.4.2, Apache 1.3.29, Oracle 10gR2 on SLES9 (SP2)


lhf

While login to remote oracle server,you should setup oracle client first.If failed with error ora-12154,Please if you web server account can acess the tnsnames.ora file or not.One way is login as root then 'su nobody' and set the correct envrionment,run sqlplus to test if it works fine.

aleigh

Warning: ocilogon(): _oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX: OCI_INVALID_HANDLE can also be caused by running the webserver with an ORACLE_HOME of a (radically?) different version than PHP was linked against.
I experienced this when I accidently used an Oracle 8 ORACLE_HOME for a PHP that was linked against Oracle 9.


rick fletcher

Using PHP 4.3.4, Apache/2.0.48, Oracle 9.2 the following line would generate the same ORA-12560 errors that lffranco reported, even with the "ORACLE_SID" environmental variable set.
<?php $DBH = OCILogon( "user", "pass" ); ?>
Once I set Oracle's hidden "LOCAL" environmental variable to the same value as "ORACLE_SID", all was well.


obatopaye

To avoid the ORACLE_SID problem/not being able to connect to database:

Apache parent thread runs as 'root' - setup root's profile to have ORACLE variables - then when script starts Apache - also initialize profile to current shell.
user 'nobody' inherits all root's profile.


lffranco *at* dco dot pemex dot com

This took me a lot of time to solve, so I'm placing it here for my future reference, and for somebody who finds it useful. I don't know if it will work on your environment, this is what I have:
* Windoze Advanced Server 2003
* IIS 6
* Oracle 8.1.7
So how I configured the whole thing? First do whatever the standard PHP configuration says... it won't work, anyway... but it will help. I installed PHP on C:\PHP; Oracle Home is in E:\Oracle\ora817.
* Install Oracle 8 client. NOTE: You must use an Oracle 8 client, I used an Oracle 9 client and for some reason (dll binding I guess), it didn't work
* Copy $ORACLE_HOME/bin/cli.dll into $WINDOWS/System32
* Modify your SQLNET.ORA file and change the line:
[code]
SQLNET.AUTHENTICATION_SERVICES= (NTS)
[/code]
by this one:
[code]
SQLNET.AUTHENTICATION_SERVICES= (NONE)
[/code]
I dunno WTF NTS is, so if somebody sends me an eMail and explain, I'll be thankful. But if you don't do this you'll get an ORA-12560 error.
And that's it for Oracle. Now, the IIS configuration:
* Open your IIS Administrator and "Web Service Extensions", add a new extension as follows:
** Extension Name: PHP
** Required Files (ADD): C:\php\extensions\php_oci8.dll; c:\php\sapi\php4isapi.dll; c:\WINDOWS\system32\oci.dll
** Check "Set Extension Status as Allowed"
Now you can use your ocli* functions, or better yet, use PEAR::DB functions which was my ultimate goal, with PEAR::DB you can forget about declaring ORACLE_HOME, ORACLE_SID and all that kind of things. Just use:
<?php
$dsn = "oci8://scott:tiger@example"
$db = DB::Connect($dsn);
?>


ben

There is a useful solution to the problem of securing connection information in the PHP Cookbook (O'Reilly) by David Sklar and Adam Trachtenberg. They propose using 'SetEnv' in the Apache configuration and then accessing the values from within a script using $_SERVER.
Unfortunately using the 'SetEnv' solution exposes your connection information to all users of that virtual host. If they run phpinfo.php or display $_SERVER, I found that they will see the password from any file under the root of that virtual host.
To restrict exposure to a particular directory or specific file:
1. First put an 'Include' to the secret file in httpd.conf. For example:
Include "/web/private/secret.txt"
2. In the password file, use the 'SetEnvIf' directive to enable the Environment variables by directory only or within a specific file. For example:
- For all files in the directory:
SetEnvIf Request_URI "/path/to/my/directory" ORACLE_PASS=5gHj790j
- For a specific file in the directory
SetEnvIf Request_URI "/path/to/my/directory/connection.oracle.php" ORACLE_PASS=5gHj790j


jeremy dot bouse

The ORACLE_SID should be known as it is the ID that designates the database you are wishing to connect to... Your oracle DBA account should have this set and running oraenv should recommend the correct SID if properly setup.

me

Some trouble-shooting notes:
When using Apache with dso support and php as a loadable module, be sure to stop/start your web server between tnsnames.ora changes (sending HUP to apache "apachectl restart" doesn't appear to flush cached connect string).
You'll see your changed connect strings in the listener log file.


TNSNAMES.ORA:
This is a very simple file to manage, yet can be very picky about your syntax.  Simply ensure that you follow one of these two examples:
Legacy SID:
alias-or-sidname =
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(Host = hostname-or-ipaddress)(Port = 1521))
   (CONNECT_DATA =
     (SID = sidname)
   )
 )
8i SERVICE NAME:
hostname.domainname.com =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = hostname-or-ipaddress)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVICE_NAME = servicename)
   )
 )
Additional notes:
- ORA/TNS-12514 error can also be caused by listener not being started.
- Ensure that httpd user (i.e. nobody) has the following in its environment (putenv is unnecessary if env is set by os via /etc/profile):
$ORACLE_SID
$ORACLE_HOME
Also, some helpful resources:
- TNS Error Messages:
http://www.oradoc.com/ora817/server.817/a76999/tnsus.htm#1000527
- TNS Listener logs:
$ORACLE_HOME/network/log/...


rkohli

Regarding connecting to an Oracle Db on NT from Linux, here is what you need to do. Little Oracle knowledge is a prerequisite.
1. Install Oracle database client onto Linux.
2. Once installed on Linux, modify the tnsanmes.ora file to create an alias to the database running on the NT box. Follow the syntax already in the tnsnames.ora file
3. Depending on the version of Oracle you have and the Oracle Database has the listener running there is a utility called tnsping(xx) that you can use to verify that you can hit a remote 0racle database syntax is tnsping <alias in tnsnames.ora>
4. You could use sqlplus to conenct to the remote database to verify the login process works. Remember to use login_id@tnsnames_alias/password
5. Once you have gotten this far PHP should be able to hit the database. Give it a shot. You might need to tool around the PHP config to get things to work. use the phpinfo function to debug, its rather useful.


marinne

One simple but useful note:check whether your TNS Listener is running! By default, it's not started automatically when an Oracle instance is started. Login as oracle then type :
lsnrctl START
After it's started, I can sucessfully run the sample code on this page! I used to got ora-12514 error before doing this.


yamakazi dot hiroshi

In reply to william_poulsen at hotmail dot com:
I was trying to connect to a Oracle database wich worked fine in a web browser but failed when i executed the script from command line.
Thanks to william_poulsen at hotmail dot com i learned that the problem was that the command line can't find the TNSNAMES.  His solution was to edit you DB to the TNSNAMES entry.  Sadly enough this didn't do the trick.  I got segmantation fault when the script was executed.  So i started to set my Oracle variables prior to executing the script.  ORACLE_SID, ORACLE_HOME, ORACLE_BASE and added $ORACLE_HOME/BIN  to the path.  After that PHP seems to use this variables and the connection can be made.  Problem solved.
I hope this can help somebody out there.


john

In addition to the earlier posts here is a further explaination;
Problem: Regular and Remote authentication does not work using Windows 2000 + PHP and Oracle 8i, 9i.
Secondary Issue if using Oracle 9.2.0.1
When using Oracle 9.2.0.1 the Error structure returned by Oracle is different than expected by PHP. As a result there will be no legible error message other than the following;
Warning: _oci_open_server: in ...
Using Oracle 9.0.1.1 the error message returned is any of the following depending on your situation;

Warning: _oci_open_server: ORA-12638: Credential retrieval failed in ...
Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in ...
Warning: _oci_open_server: ORA-12505: TNS:listener could not resolve SID given in connect descriptor in ...

Resolution:
In order to get this to work properly you need to do the following;
In reference to ORA-12638: Credential retrieval failed in ...
you need to edit your sqlnet.ora file and change the
SQLNET.AUTHENTICATION_SERVICES = (NTS) to
SQLNET.AUTHENTICATION_SERVICES = (NONE)
The reason is that using NTS validation on a Windows 2000 machine essentially means Kerberos.
Using (NONE) will tell oracle not to expect kerberos "Credentials" as a means of validation. In turn it will use the oracle authentication for a database user.
In reference to ORA-12154 and ORA-12505 you need to do the following;
In your php code you are using to connect you need to copy the section in tnsnames.ora
into a variable.
For example;
<?php
putenv("ORACLE_SID=TESTDB");
//putenv("ORACLE_HOME=/oracle/ora90");
//putenv("TNS_ADMIN=/oracle/ora90/network/admin");
$username = "scott";
$passwd = "tiger";
$db="(DESCRIPTION=
          (ADDRESS_LIST=
            (ADDRESS=(PROTOCOL=TCP)
              (HOST=yourTargetMachine)(PORT=1521)
            )
          )
            (CONNECT_DATA=(SERVICE_NAME=TESTDB))
     )";
$conn = OCILogon($username,$passwd,$db);
if (!$conn)
{
   echo "Connection failed";
   echo "Error Message: [" . OCIError($conn) . "]";
   exit;
}
else
{
   echo "Connected!";
}
...
?>
I left the ORACLE_HOME and TNS_ADMIN putenv lines commented out and your need for them depends on which web server you are using. If you are using Apache, you may need both.
If you are using Microsoft IIS you may need ORACLE_HOME. Putting it in can't hurt and it appears PHP may read them if they are there but either way you should be working at this
point.
Live long and prosper.


dbrown3205

If you're running an apache server, make sure you have php setup as a module. Then just include the environment variables in the apache config, and use all 3 parts of the ocilogon. You don't even have to copy the tsnnames.ora definition, just use the standard sid

tof

If you want the change NLS_LANG (e.g.:  NLS_LANG="FRENCH_FRANCE.WE8ISO8859P1") don't forget to also set LC_ALL and LANG (e.g.: LC_ALL=french and LANG=french) else you'll have a ORA-01756 when you try to call ocilogon.

vasquez

If you try to connect to an Oracle7 database,
and you get the "ora-01005, null password given errror", make sure to do the following:
-install net8 (ok, you already did)
- use net8 as ORACLE_HOME *for the webserver*!
- add the user of the httpd process  (nobody or www or whatever) to the group oracle
- use the TWO_TASK env for connecting


akolk

If you have Oracle8i installed, link against those directories. That will give you a number of usefull performance boosts while fetching data from the database. These optimizations will only work if your client libraries and server libraries are Oracle8i

ed000001

If you get your connectivity working with putenv on ORACLE_SID and ORACLE_HOME, but you do not want to use putenv because you want safemode on. You will need to pass these from your environment variables.  Somehow setenv in httpd.conf did not do the trick for me... the values are set but the connectivity does not work.  Then you will need to set the environment in your /etc/init.d/apachectl or /etc/profile and use a "PassEnv ORACLE_HOME ORACLE_SID" directive in httpd.conf so that these variables are picked up by php.
However, when you suexec in Apache 2.0, the server will only allow you to pass a given set of variables which are defined in the apache source code in the file apache-dir/support/suexec.c
In order to pass ORACLE_SID and ORACLE_HOME to PHP you need to add these to that file.  The relevant changed piece of code where I added "ORACLE_" looks something like this:
char *safe_env_lst[] =
{
   /* variable name starts with */
   "HTTP_",
   "SSL_",
   "ORACLE_",
   /* variable name is */
...
You will have to do a "make clean", "./configure", "make", "make install".  Do not forget to do the "make clean" or the apache changes will not be picked up.
Here is a nice php test script :)
<?php // test-oracle.php
   function dump_array($a_value)
   {
       reset($a_value);
       for ( $s_str = '' ; list($s_key, $x_value) = each($a_value) ;  )
       {
           $s_str .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".
                     "<span style=\"color:green\">[</span>$s_key<span style=\"color:green\">]</span> = ".
                     "<span style=\"color:red\">[</span>$x_value<span style=\"color:red\">]</span><br />";
       }
       reset($a_value);
       echo $s_str;
   }
#putenv("ORACLE_SID=ORTD");
#putenv("ORACLE_HOME=/u01/app/oracle/product/9.2.0.1.0");
$ORACLE_SID = getenv("ORACLE_SID");
$ORACLE_HOME = getenv("ORACLE_HOME");
echo "ORACLE_SID = $ORACLE_SID
";
echo "ORACLE_HOME = $ORACLE_HOME
";
   $cn = ociplogon('scott', 'tiger');
echo "cn = $cn<br />\n";
   $st = ociparse($cn, "select tname from tab");
echo "st = $st<br />\n";
   $ex = ociexecute($st,OCI_COMMIT_ON_SUCCESS);
echo "ex = $ex<br />\n";
   $mr = ocifetchinto($st,$xx,OCI_ASSOC);
   while ( $mr )
   {
       dump_array($xx);
       $mr = ocifetchinto($st,$xx,OCI_ASSOC);
   }
   $fr = ocifreestatement($st);
echo "fr = $fr<br />";
   ocicommit($cn);
   ocilogoff($cn);
?>


william_poulsen

If you are trying to do an Oracle query from the command line you may need to manually configure ORACLE_SID.  If, for example, you want the server to generate emails based on the contents of some tables you can setup a cron job to run your PHP script as opposed to requiring somebody to go to the page in a browser.  From a PHP script within a browser you can do something like the following because the TSANames are configured within Apache...
<?php
$db = "DBNAME";
$odbc = ocilogon ('USER', 'PASS', $db) or die( "Could not connect to Oracle database!");
if ($odbc == false){
  $msg = OCIError($odbc)."
";}
?>
From a commandline script you have to change the $db variable as follows...
#!/path/to/commandline/php
<?php
$db ="(DESCRIPTION =
     (ADDRESS =
        (PROTOCOL = TCP)
        (HOST = HOSTNAMEHERE)
        (PORT = 1521)
     )
   (CONNECT_DATA = (SID = SIDNAMEHERE))
 )";
$odbc = ocilogon ('user', 'pass', $db) or die( "Could not connect to Oracle database!") or die (ocierror());
?>


c_caughlan

If you are experiencing problems logging onto your Oracle DB, maybe a ORA-12154 error or something like that, try setting the ORACLE_HOME, ORACLE_SID, TNS_ADMIN vars in your Apache config, rather than using PutEnv() inside PHP. Its because PHP/Apache needs to know these variables upon server startup, not when it serves the PHP page. Of course, this assumes you have OCI installed locally on the webserver, if you dont, no matter what variables you set and where, it just wont work.

cjbj

If PHP is linked with Oracle 10g (or later) client libraries, the Easy
Connection syntax can be used to identify which database to connect
to.  This can remove the need for a local tnsnames.ora file or complex
connect string.  The new syntax can be used to connect to earlier
versions of Oracle.
With Oracle 10g client libraries, the third parameter "db" for
OCILogon can have the syntax:
   [//]host[:port][/service_name]
An example is:
   $c = OCILogon('scott', 'tiger', '//mymachine.mydomain/mydbservice');
The pre-10g syntax equivalent is something like:
   $c = OCILogon('scott', 'tiger',
       '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
       (HOST=mymachine.mydomain) (PORT=1521)))
       (CONNECT_DATA=(SERVICE_NAME=MYDBSERVICE)))');
The full syntax continues to work with 10g.  It allows for more
complex configuration than available with the Easy Connect method.
Oracle documentation and the fine print for Easy Connect is at:
http://download-west.oracle.com/docs/cd/B12037_01/network.101/
b10775/naming.htm#i498306
(note the split URL due to PHP doc site limitations needs to be recombined for use)


aliquis

I've had all kinds of errors with RedHat9(yuck), PHP 4.3.4RC1 and Oracle enterprice server 9.2. For some time I thought that --with-oci8 wouldn't work with Oracle9 but that wasn't the case, the solution was many steps.
1) install oracle, might require some tricks, on RedHat9 I had to put this in my .bashrc:
export ORACLE_BASE=/opt/ora9
export ORACLE_HOME=$ORACLE_BASE/product/9.2
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=netadmdb
export ORACLE_TERM=vt100
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$ORACLE_BASE/product/9.2/lib:$LD_LIBRARY_PATH
2) compile php, use --with-oci8
3) Make an init-script for the oracle9 database server, as default the TNS listener doesn't run so add that on aswell, example:
#!/bin/bash
export ORACLE_HOME=/opt/ora9/product/9.2
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=netadmdb
export DISPLAY=:0
oracle_user=oracle
export oracle_user
case $1 in
start)
su - "$oracle_user"<<EOO
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
/opt/ora9/product/9.2/bin/lsnrctl start
EOO
;;
stop)
su - "$oracle_user"<<EOO
/opt/ora9/product/9.2/bin/lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
EOO
;;
*)
echo "Usage: ora9 [start|stop]"
;;
esac
4) Configure Apache. For some reason it requires some tweaking with environment variables, in the begining I put those in the PHP-script with putenv, later in the httpd.conf with SetEnv and the mod_env module. But I was told to not do that and instead set them in the init script for Apache. So I copied apachectl to /etc/init.d and edited envvars in $APACHE_PATH/bin. First I added all kinds of env variables until I got it to work, and then I removed them one at a time and came to the following minimal configuration:
LD_LIBRARY_PATH="/usr/local/apache2/lib:$LD_LIBRARY_PATH"
ORACLE_HOME=/opt/ora9/product/9.2
LANG=sv_SE
export LD_LIBRARY_PATH ORACLE_HOME LANG
Earlier I had added NLS_LANG and TNS_ADMIN above those mentioned above (point 1), but it seems those aren't needed really. So no need for TWO_TASK or ORACLE_SID, only needed one is ORACLE_HOME and if you get missing/invalid option for your OCILogon set LANG to something else like I did. Someone earlier said it might have to do with UTF8.
So if you are sure lsncrtl are started and that you have the correct env-variables set in your $APACHE_PATH/bin/envvars you can just use something like:
$iDBConn=OCILogon("user","pass","netadmdb");
in your PHP-script and it should work.
Hope this helps someone.


ben

I spent ages trying work out why I was getting the following message when when using ocilogon() on Windows 2000 using PHP 4 and 5:
ORA-03106 Fatal two-task communication protocol error
This problem is occurs when PHP cannot find ORACLE client environmental variables.
The environmental variables can be set in several ways:
1. Within the root 'Directory' directive on Apache httpd.conf:
<Directory "d:/path/to/webroot">
 SetEnv ORACLE_BASE "c:/oracle"
 SetEnv ORACLE_HOME "c:/oracle/ora81"
 SetEnv NLS_LANG "american_america.WE8DEC"
 SetEnv NLS_CHARACTERSET "WE8DEC"
 SetEnv NLS_NCHAR_CHARACTERSET "AL16UTF16"
</Directory>
or
2. Within Windows:
Go to the Control Panel>System>Advanced>Environmental Variables
Then enter a name value/pair for each of the variables.
3. Using putenv() statements in the PHP file prior to using ocilogon(). This is not ideal because the statements are required evertime you wish to connect to Oracle.


nospamplz!esartoni

I had a little problem with ocilogon but only with RedHat 8.0. It always returned some kind of error during connection like 'OCISessionBegin - ... invalid character', or 'OCISessionBegin - ... missing or invalid option in ...'
I have finally found what is this problem! You have to change your LANG enviroment variable disabling UTF-8. Example: LANG=en_US.UTF-8 should become LANG=en_US.


neogodo

Hey guys!!!!
I have all these problems and when are solved a php show this:
_oci_server ORA-12159:connection text especified is too long
It's simple!!!
 In the TNSNAMES.ORA remove all space, tab, carriage return on the conection string and, wallah!!! All work fine!!!
 More info:
  PHP 5.0.0  with Oci8
  Apache 1.3
Regards,
Romolo (neogodo@yahoo.com.br).
DBA Oracle
Brazil - SP - Sao Paulo


tomasz dot kokowski

Getting PHP 4.3.3 (and lower versions) to work
with Apache v2.xxx and Oracle 8i was easy.
But just after Oracle upgrade to 9i ugly message
appeared when ocologon () was called :
Warning: ocilogon(): _oci_open_session: OCIHandleAlloc OCI_HTYPE_SVCCTX: OCI_INVALID_HANDLE
What we should do? All environment variables
has been set correctly, tnsnames too (it worked
under oracle 8i).
The solution was posted 2003-09-17 22:24 by
Andy Hassall (andy@andyh.co.uk) responding in
news:comp.lang.php threat "PHP & OCI9. No such..."
"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."
That's correct. I've added r-x permissions for others
for oracle user $HOME and got nice message - logged
with success!
Tomasz Kokowski


i990712

For those of you who are having Oracle errors: ORA-12154 or ORA-12505 or ORA-01005 do the folowing:
The folowing precedures have been tested when connecting to a HP UX with Oracle 7.x using of couse the OCI8 as the client interface.
Add those lines to the web server config files or set and export those ones before the web server starts.
On Apache add these lines to httpd.conf:
SetEnv ORACLE_HOME /usr/local/oracle
SetEnv ORACLE_SID <sid>
SetEnv LD_LIBRARY_PATH /usr/local/oracle/lib
SetEnv TNS_ADMIN /usr/local/oracle/tnsnames.ora
SetEnv TWO_TASK /usr/local/oracle/tnsnames.ora
SetEnv NLS_LANG  English_America.WE8ISO8859P1
SetEnv ORACLE_BASE /usr/local
When calling the OCILogon do this:
$db = "  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP) (HOST =server_ip_or_dns_name)(PORT = 1521))
   (CONNECT_DATA= (SID = _sid_))
   )";
The previous definition is a copy of the service definition that is stored in the tnsnames.ora file.
Next, call the OCILogon function using the folowing format:
OCILogon("user/password","password", $db);
To avoid ORA-01005 error, set the NLS_LANG environment variable to English_America.WE8ISO8859P1 ( some other values may work...but we have found that this one works for us )
To avoid ORA-12154 and ORA-12505, use the service definition as the OCILogon third parameter.
I'd like to thanks to a friend of mine a.k.a Rosa for the user/password tip.
Regards
Miguel Carvalho


franks

For those having Oracle errors, I find out that little something, while using Apache2. I don't know if this applies also to Apache 1.x, but for Apache2, this is the ultimate solution!
Especially with ORA-12154 and ORA-12505, some said to write the following code in your php script, but if you have access to the configuration or your web server, DON'T!
<?php
putenv("ORACLE_SID=TESTDB");
//putenv("ORACLE_HOME=/oracle/ora90");
//putenv("TNS_ADMIN=/oracle/ora90/network/admin");
$username = "scott";
$passwd = "tiger";
$db="(DESCRIPTION=
         (ADDRESS_LIST=
           (ADDRESS=(PROTOCOL=TCP)
             (HOST=yourTargetMachine)(PORT=1521)
           )
         )
          (CONNECT_DATA=(SERVICE_NAME=TESTDB))
    )";
$conn = OCILogon($username,$passwd,$db);
...
?>
All right, like I said, if you have access to the configuration of apache, there is a file in $APACHE2/bin called envvars. Simply put the necessary environment variables needed by Oracle in this file: ORACLE_SID, ORACLE_BASE, ORACLE_HOME and myself I also added LD_LIBRARY_PATH with oracle directories.
At first, my problem was that I didn't had all the environment sets when rebooting the server, but if I'd stop apache, then restart it, while beeing root, all the environment was there. Setting the envvars file correctly solved the reboot problem.
Hope this will help!
Franks


bluei

check your tnsnames.ora permission.
ex)
ORACLE_HOME = /home/oracle/oracle
chmod 755 /home/oracle/oracle/network/admin -R
Yahoo!!!!!! I solved it!!!


nino

After a long time trying to get a select to work I found something that is not in the comments. TWO_TASK environment variable must be set to the database alias in tnsnames.ora for it to work with my setup.
RH 9.0 (Apache 2.0)
PHP 4.2.2 with SRPM recompiled with oci8 support
Oracle 8.1.7.0.0 client installed
Hope it helps some poor soul.
/Nicke


Change Language


Follow Navioo On Twitter
oci_bind_array_by_name
oci_bind_by_name
oci_cancel
oci_close
OCI-Collection->append
OCI-Collection->assign
OCI-Collection->assignElem
OCI-Collection->free
OCI-Collection->getElem
OCI-Collection->max
OCI-Collection->size
OCI-Collection->trim
oci_commit
oci_connect
oci_define_by_name
oci_error
oci_execute
oci_fetch_all
oci_fetch_array
oci_fetch_assoc
oci_fetch_object
oci_fetch_row
oci_fetch
oci_field_is_null
oci_field_name
oci_field_precision
oci_field_scale
oci_field_size
oci_field_type_raw
oci_field_type
oci_free_statement
oci_internal_debug
OCI-Lob->append
OCI-Lob->close
oci_lob_copy
OCI-Lob->eof
OCI-Lob->erase
OCI-Lob->export
OCI-Lob->flush
OCI-Lob->free
OCI-Lob->getBuffering
OCI-Lob->import
oci_lob_is_equal
OCI-Lob->load
OCI-Lob->read
OCI-Lob->rewind
OCI-Lob->save
OCI-Lob->saveFile
OCI-Lob->seek
OCI-Lob->setBuffering
OCI-Lob->size
OCI-Lob->tell
OCI-Lob->truncate
OCI-Lob->write
OCI-Lob->writeTemporary
OCI-Lob->writeToFile
oci_new_collection
oci_new_connect
oci_new_cursor
oci_new_descriptor
oci_num_fields
oci_num_rows
oci_parse
oci_password_change
oci_pconnect
oci_result
oci_rollback
oci_server_version
oci_set_prefetch
oci_statement_type
ocibindbyname
ocicancel
ocicloselob
ocicollappend
ocicollassign
ocicollassignelem
ocicollgetelem
ocicollmax
ocicollsize
ocicolltrim
ocicolumnisnull
ocicolumnname
ocicolumnprecision
ocicolumnscale
ocicolumnsize
ocicolumntype
ocicolumntyperaw
ocicommit
ocidefinebyname
ocierror
ociexecute
ocifetch
ocifetchinto
ocifetchstatement
ocifreecollection
ocifreecursor
ocifreedesc
ocifreestatement
ociinternaldebug
ociloadlob
ocilogoff
ocilogon
ocinewcollection
ocinewcursor
ocinewdescriptor
ocinlogon
ocinumcols
ociparse
ociplogon
ociresult
ocirollback
ocirowcount
ocisavelob
ocisavelobfile
ociserverversion
ocisetprefetch
ocistatementtype
ociwritelobtofile
ociwritetemporarylob
eXTReMe Tracker