note 35119 added to function.ocilogon
| From: | Franks at rack1 dot php dot net | Date: | Wed, 20 Aug 2003 12:52:48 +0000 |
| Subject: | note 35119 added to function.ocilogon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54743@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.ocilogon.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35119
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35119&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35119&report=yes