note 43335 deleted from function.ocilogon by sixd
| From: | sixd@php.net | Date: | Mon, 05 Oct 2009 01:37:16 +0000 |
| Subject: | note 43335 deleted from function.ocilogon by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161294@lists.php.net to get a copy of this message | ||
Note Submitter: william_poulsen at hotmail dot com
----
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)."<BR>";}
?>
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());
?>